diff --git a/plugins/channelmimo/interferometer/interferometer.cpp b/plugins/channelmimo/interferometer/interferometer.cpp index 2700c5547..5980d66fe 100644 --- a/plugins/channelmimo/interferometer/interferometer.cpp +++ b/plugins/channelmimo/interferometer/interferometer.cpp @@ -342,6 +342,12 @@ void Interferometer::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getInterferometerSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getInterferometerSettings()->getSpectrumConfig()); + } + if (settings.m_scopeGUI && channelSettingsKeys.contains("scopeConfig")) { + settings.m_scopeGUI->updateFrom(channelSettingsKeys, response.getInterferometerSettings()->getScopeConfig()); + } } void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const InterferometerSettings& settings) @@ -367,6 +373,34 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings response.getInterferometerSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getInterferometerSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getInterferometerSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getInterferometerSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getInterferometerSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getInterferometerSettings()->setSpectrumConfig(swgGLSpectrum); + } + } + + if (settings.m_scopeGUI) + { + if (response.getInterferometerSettings()->getScopeConfig()) + { + settings.m_scopeGUI->formatTo(response.getInterferometerSettings()->getScopeConfig()); + } + else + { + SWGSDRangel::SWGGLScope *swgGLScope = new SWGSDRangel::SWGGLScope(); + settings.m_scopeGUI->formatTo(swgGLScope); + response.getInterferometerSettings()->setScopeConfig(swgGLScope); + } + } } void Interferometer::webapiReverseSendSettings(QList& channelSettingsKeys, const InterferometerSettings& settings, bool force) @@ -444,6 +478,20 @@ void Interferometer::webapiFormatChannelSettings( if (channelSettingsKeys.contains("filterChainHash") || force) { swgInterferometerSettings->setFilterChainHash(settings.m_filterChainHash); } + + if (settings.m_spectrumGUI) + { + if (channelSettingsKeys.contains("spectrumConfig") || force) { + settings.m_spectrumGUI->formatTo(swgInterferometerSettings->getSpectrumConfig()); + } + } + + if (settings.m_scopeGUI) + { + if (channelSettingsKeys.contains("scopeConfig") || force) { + settings.m_scopeGUI->formatTo(swgInterferometerSettings->getScopeConfig()); + } + } } void Interferometer::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelmimo/interferometer/interferometergui.cpp b/plugins/channelmimo/interferometer/interferometergui.cpp index fc79e4744..20ace3efe 100644 --- a/plugins/channelmimo/interferometer/interferometergui.cpp +++ b/plugins/channelmimo/interferometer/interferometergui.cpp @@ -85,6 +85,8 @@ bool InterferometerGUI::handleMessage(const Message& message) { const Interferometer::MsgConfigureInterferometer& notif = (const Interferometer::MsgConfigureInterferometer&) message; m_settings = notif.getSettings(); + ui->scopeGUI->updateSettings(); + ui->spectrumGUI->updateSettings(); displaySettings(); return true; } diff --git a/plugins/channelmimo/interferometer/interferometerwebapiadapter.cpp b/plugins/channelmimo/interferometer/interferometerwebapiadapter.cpp index 7738eb931..d22bc02ce 100644 --- a/plugins/channelmimo/interferometer/interferometerwebapiadapter.cpp +++ b/plugins/channelmimo/interferometer/interferometerwebapiadapter.cpp @@ -59,7 +59,7 @@ void InterferometerWebAPIAdapter::webapiFormatChannelSettings( swgScope->setTime(scopeSettings.m_time); swgScope->setTimeOfs(scopeSettings.m_timeOfs); swgScope->setTraceIntensity(scopeSettings.m_traceIntensity); - swgScope->setTraceLen(scopeSettings.m_traceLen); + swgScope->setTraceLenMult(scopeSettings.m_traceLenMult); swgScope->setTrigPre(scopeSettings.m_trigPre); // array of traces @@ -178,8 +178,8 @@ void InterferometerWebAPIAdapter::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("scopeConfig.traceIntensity")) { scopeSettings.m_traceIntensity = response.getInterferometerSettings()->getScopeConfig()->getTraceIntensity(); } - if (channelSettingsKeys.contains("scopeConfig.traceLen")) { - scopeSettings.m_traceLen = response.getInterferometerSettings()->getScopeConfig()->getTraceLen(); + if (channelSettingsKeys.contains("scopeConfig.traceLenMult")) { + scopeSettings.m_traceLenMult = response.getInterferometerSettings()->getScopeConfig()->getTraceLenMult(); } if (channelSettingsKeys.contains("scopeConfig.trigPre")) { scopeSettings.m_trigPre = response.getInterferometerSettings()->getScopeConfig()->getTrigPre(); diff --git a/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.cpp b/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.cpp index c7cc54b84..5bf3f2093 100644 --- a/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.cpp @@ -70,84 +70,13 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings( SWGSDRangel::SWGGLScope *swgScope = new SWGSDRangel::SWGGLScope(); swgScope->init(); response.getChannelAnalyzerSettings()->setScopeConfig(swgScope); - swgScope->setDisplayMode(scopeSettings.m_displayMode); - swgScope->setGridIntensity(scopeSettings.m_gridIntensity); - swgScope->setTime(scopeSettings.m_time); - swgScope->setTimeOfs(scopeSettings.m_timeOfs); - swgScope->setTraceIntensity(scopeSettings.m_traceIntensity); - swgScope->setTraceLen(scopeSettings.m_traceLen); - swgScope->setTrigPre(scopeSettings.m_trigPre); - - // array of traces - swgScope->setTracesData(new QList); - std::vector::const_iterator traceIt = scopeSettings.m_tracesData.begin(); - - for (; traceIt != scopeSettings.m_tracesData.end(); ++traceIt) - { - swgScope->getTracesData()->append(new SWGSDRangel::SWGTraceData); - swgScope->getTracesData()->back()->setStreamIndex(traceIt->m_streamIndex); - swgScope->getTracesData()->back()->setAmp(traceIt->m_amp); - swgScope->getTracesData()->back()->setHasTextOverlay(traceIt->m_hasTextOverlay ? 1 : 0); - swgScope->getTracesData()->back()->setStreamIndex(traceIt->m_streamIndex); - swgScope->getTracesData()->back()->setOfs(traceIt->m_ofs); - swgScope->getTracesData()->back()->setProjectionType((int) traceIt->m_projectionType); - swgScope->getTracesData()->back()->setTextOverlay(new QString(traceIt->m_textOverlay)); - swgScope->getTracesData()->back()->setTraceColor(qColorToInt(traceIt->m_traceColor)); - swgScope->getTracesData()->back()->setTraceColorB(traceIt->m_traceColorB); - swgScope->getTracesData()->back()->setTraceColorG(traceIt->m_traceColorG); - swgScope->getTracesData()->back()->setTraceColorR(traceIt->m_traceColorR); - swgScope->getTracesData()->back()->setTraceDelay(traceIt->m_traceDelay); - swgScope->getTracesData()->back()->setTraceDelayCoarse(traceIt->m_traceDelayCoarse); - swgScope->getTracesData()->back()->setTraceDelayFine(traceIt->m_traceDelayFine); - swgScope->getTracesData()->back()->setTriggerDisplayLevel(traceIt->m_triggerDisplayLevel); - swgScope->getTracesData()->back()->setViewTrace(traceIt->m_viewTrace ? 1 : 0); - } - - // array of triggers - swgScope->setTriggersData(new QList); - std::vector::const_iterator triggerIt = scopeSettings.m_triggersData.begin(); - - for (; triggerIt != scopeSettings.m_triggersData.end(); ++triggerIt) - { - swgScope->getTriggersData()->append(new SWGSDRangel::SWGTriggerData); - swgScope->getTriggersData()->back()->setStreamIndex(triggerIt->m_streamIndex); - swgScope->getTriggersData()->back()->setInputIndex(triggerIt->m_inputIndex); - swgScope->getTriggersData()->back()->setProjectionType((int) triggerIt->m_projectionType); - swgScope->getTriggersData()->back()->setTriggerBothEdges(triggerIt->m_triggerBothEdges ? 1 : 0); - swgScope->getTriggersData()->back()->setTriggerColor(qColorToInt(triggerIt->m_triggerColor)); - swgScope->getTriggersData()->back()->setTriggerColorB(triggerIt->m_triggerColorB); - swgScope->getTriggersData()->back()->setTriggerColorG(triggerIt->m_triggerColorG); - swgScope->getTriggersData()->back()->setTriggerColorR(triggerIt->m_triggerColorR); - swgScope->getTriggersData()->back()->setTriggerDelay(triggerIt->m_triggerDelay); - swgScope->getTriggersData()->back()->setTriggerDelayCoarse(triggerIt->m_triggerDelayCoarse); - swgScope->getTriggersData()->back()->setTriggerDelayFine(triggerIt->m_triggerDelayFine); - swgScope->getTriggersData()->back()->setTriggerDelayMult(triggerIt->m_triggerDelayMult); - swgScope->getTriggersData()->back()->setTriggerHoldoff(triggerIt->m_triggerHoldoff ? 1 : 0); - swgScope->getTriggersData()->back()->setTriggerLevel(triggerIt->m_triggerLevel); - swgScope->getTriggersData()->back()->setTriggerLevelCoarse(triggerIt->m_triggerLevelCoarse); - swgScope->getTriggersData()->back()->setTriggerLevelFine(triggerIt->m_triggerLevelFine); - swgScope->getTriggersData()->back()->setTriggerPositiveEdge(triggerIt->m_triggerPositiveEdge ? 1 : 0); - swgScope->getTriggersData()->back()->setTriggerRepeat(triggerIt->m_triggerRepeat); - } + scopeSettings.formatTo(swgScope); // spectrum SWGSDRangel::SWGGLSpectrum *swgSpectrum = new SWGSDRangel::SWGGLSpectrum(); swgSpectrum->init(); response.getChannelAnalyzerSettings()->setSpectrumConfig(swgSpectrum); - swgSpectrum->setAveragingMode((int) spectrumSettings.m_averagingMode); - swgSpectrum->setAveragingValue(SpectrumSettings::getAveragingValue(spectrumSettings.m_averagingIndex, spectrumSettings.m_averagingMode)); - swgSpectrum->setDecay(spectrumSettings.m_decay); - swgSpectrum->setDecayDivisor(spectrumSettings.m_decayDivisor); - swgSpectrum->setDisplayCurrent(spectrumSettings.m_displayCurrent ? 1 : 0); - swgSpectrum->setDisplayGrid(spectrumSettings.m_displayGrid ? 1 : 0); - swgSpectrum->setDisplayGridIntensity(spectrumSettings.m_displayGridIntensity); - swgSpectrum->setDisplayHistogram(spectrumSettings.m_displayHistogram ? 1 : 0); - swgSpectrum->setDisplayMaxHold(spectrumSettings.m_displayMaxHold ? 1 : 0); - swgSpectrum->setDisplayTraceIntensity(spectrumSettings.m_displayTraceIntensity); - swgSpectrum->setDisplayWaterfall(spectrumSettings.m_displayWaterfall ? 1 : 0); - swgSpectrum->setFftOverlap(spectrumSettings.m_fftOverlap); - swgSpectrum->setFftSize(spectrumSettings.m_fftSize); - swgSpectrum->setFpsPeriodMs(spectrumSettings.m_fpsPeriodMs); + spectrumSettings.formatTo(swgSpectrum); } int ChannelAnalyzerWebAPIAdapter::webapiSettingsPutPatch( @@ -227,225 +156,11 @@ void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings( settings.m_title = *response.getChannelAnalyzerSettings()->getTitle(); } // scope - if (channelSettingsKeys.contains("scopeConfig")) - { - if (channelSettingsKeys.contains("scopeConfig.displayMode")) { - scopeSettings.m_displayMode = (GLScopeSettings::DisplayMode) response.getChannelAnalyzerSettings()->getScopeConfig()->getDisplayMode(); - } - if (channelSettingsKeys.contains("scopeConfig.gridIntensity")) { - scopeSettings.m_gridIntensity = response.getChannelAnalyzerSettings()->getScopeConfig()->getGridIntensity(); - } - if (channelSettingsKeys.contains("scopeConfig.time")) { - scopeSettings.m_time = response.getChannelAnalyzerSettings()->getScopeConfig()->getTime(); - } - if (channelSettingsKeys.contains("scopeConfig.timeOfs")) { - scopeSettings.m_timeOfs = response.getChannelAnalyzerSettings()->getScopeConfig()->getTimeOfs(); - } - if (channelSettingsKeys.contains("scopeConfig.traceIntensity")) { - scopeSettings.m_traceIntensity = response.getChannelAnalyzerSettings()->getScopeConfig()->getTraceIntensity(); - } - if (channelSettingsKeys.contains("scopeConfig.traceLen")) { - scopeSettings.m_traceLen = response.getChannelAnalyzerSettings()->getScopeConfig()->getTraceLen(); - } - if (channelSettingsKeys.contains("scopeConfig.trigPre")) { - scopeSettings.m_trigPre = response.getChannelAnalyzerSettings()->getScopeConfig()->getTrigPre(); - } - // traces - if (channelSettingsKeys.contains("scopeConfig.tracesData")) - { - QList *tracesData = response.getChannelAnalyzerSettings()->getScopeConfig()->getTracesData(); - scopeSettings.m_tracesData.clear(); - - for (int i = 0; i < 10; i++) // no more than 10 traces anyway - { - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1]").arg(i))) - { - SWGSDRangel::SWGTraceData *traceData = tracesData->at(i); - scopeSettings.m_tracesData.push_back(GLScopeSettings::TraceData()); - - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].streamIndex").arg(i))) { - scopeSettings.m_tracesData.back().m_streamIndex = traceData->getStreamIndex(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].amp").arg(i))) { - scopeSettings.m_tracesData.back().m_amp = traceData->getAmp(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].hasTextOverlay").arg(i))) { - scopeSettings.m_tracesData.back().m_hasTextOverlay = traceData->getHasTextOverlay() != 0; - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].inputIndex").arg(i))) { - scopeSettings.m_tracesData.back().m_streamIndex = traceData->getStreamIndex(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].ofs").arg(i))) { - scopeSettings.m_tracesData.back().m_ofs = traceData->getOfs(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].projectionType").arg(i))) { - scopeSettings.m_tracesData.back().m_projectionType = (Projector::ProjectionType) traceData->getProjectionType(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].traceColor").arg(i))) { - scopeSettings.m_tracesData.back().m_traceColor = intToQColor(traceData->getTraceColor()); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].traceColorB").arg(i))) { - scopeSettings.m_tracesData.back().m_traceColorB = traceData->getTraceColorB(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].traceColorG").arg(i))) { - scopeSettings.m_tracesData.back().m_traceColorG = traceData->getTraceColorG(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].traceColorR").arg(i))) { - scopeSettings.m_tracesData.back().m_traceColorR = traceData->getTraceColorR(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].traceDelay").arg(i))) { - scopeSettings.m_tracesData.back().m_traceDelay = traceData->getTraceDelay(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].traceDelayCoarse").arg(i))) { - scopeSettings.m_tracesData.back().m_traceDelayCoarse = traceData->getTraceDelayCoarse(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].traceDelayFine").arg(i))) { - scopeSettings.m_tracesData.back().m_traceDelayFine = traceData->getTraceDelayFine(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].triggerDisplayLevel").arg(i))) { - scopeSettings.m_tracesData.back().m_triggerDisplayLevel = traceData->getTriggerDisplayLevel(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].viewTrace").arg(i))) { - scopeSettings.m_tracesData.back().m_viewTrace = traceData->getViewTrace() != 0; - } - } - else - { - break; - } - } - } - // triggers - if (channelSettingsKeys.contains("scopeConfig.triggersData")) - { - QList *triggersData = response.getChannelAnalyzerSettings()->getScopeConfig()->getTriggersData(); - scopeSettings.m_triggersData.clear(); - - for (int i = 0; i < 10; i++) // no more than 10 triggers anyway - { - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1]").arg(i))) - { - SWGSDRangel::SWGTriggerData *triggerData = triggersData->at(i); - scopeSettings.m_triggersData.push_back(GLScopeSettings::TriggerData()); - - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].streamIndex").arg(i))) { - scopeSettings.m_triggersData.back().m_streamIndex = triggerData->getStreamIndex(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].inputIndex").arg(i))) { - scopeSettings.m_triggersData.back().m_inputIndex = triggerData->getInputIndex(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].projectionType").arg(i))) { - scopeSettings.m_triggersData.back().m_projectionType = (Projector::ProjectionType) triggerData->getProjectionType(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerBothEdges").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerBothEdges = triggerData->getTriggerBothEdges() != 0; - } - if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].triggerColor").arg(i))) { - scopeSettings.m_tracesData.back().m_traceColor = intToQColor(triggerData->getTriggerColor()); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerColorB").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerColorB = triggerData->getTriggerColorB(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerColorG").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerColorG = triggerData->getTriggerColorG(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerColorR").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerColorR = triggerData->getTriggerColorR(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerDelay").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerDelay = triggerData->getTriggerDelay(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerDelayCoarse").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerDelayCoarse = triggerData->getTriggerDelayCoarse(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerDelayFine").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerDelayFine = triggerData->getTriggerDelayFine(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerDelayMult").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerDelayMult = triggerData->getTriggerDelayMult(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerHoldoff").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerHoldoff = triggerData->getTriggerHoldoff(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerLevel").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerLevel = triggerData->getTriggerLevel(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerLevelCoarse").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerLevelCoarse = triggerData->getTriggerLevelCoarse(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerLevelFine").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerLevelFine = triggerData->getTriggerLevelFine(); - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerPositiveEdge").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerPositiveEdge = triggerData->getTriggerPositiveEdge() != 0; - } - if (channelSettingsKeys.contains(QString("scopeConfig.triggersData[%1].triggerRepeat").arg(i))) { - scopeSettings.m_triggersData.back().m_triggerRepeat = triggerData->getTriggerRepeat() != 0; - } - } - } - } + if (channelSettingsKeys.contains("scopeConfig")) { + scopeSettings.updateFrom(channelSettingsKeys, response.getChannelAnalyzerSettings()->getScopeConfig()); } // spectrum - if (channelSettingsKeys.contains("spectrumConfig")) - { - if (channelSettingsKeys.contains("spectrumConfig.averagingMode")) { - spectrumSettings.m_averagingMode = (SpectrumSettings::AveragingMode) response.getChannelAnalyzerSettings()->getSpectrumConfig()->getAveragingMode(); - } - if (channelSettingsKeys.contains("spectrumConfig.averagingValue")) - { - spectrumSettings.m_averagingValue = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getAveragingValue(); - spectrumSettings.m_averagingIndex = SpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode); - } - if (channelSettingsKeys.contains("spectrumConfig.decay")) { - spectrumSettings.m_decay = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDecay(); - } - if (channelSettingsKeys.contains("spectrumConfig.decayDivisor")) { - spectrumSettings.m_decayDivisor = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDecayDivisor(); - } - if (channelSettingsKeys.contains("spectrumConfig.displayCurrent")) { - spectrumSettings.m_displayCurrent = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDisplayCurrent() != 0; - } - if (channelSettingsKeys.contains("spectrumConfig.displayGrid")) { - spectrumSettings.m_displayGrid = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDisplayGrid() != 0; - } - if (channelSettingsKeys.contains("spectrumConfig.displayGridIntensity")) { - spectrumSettings.m_displayGridIntensity = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDisplayGridIntensity(); - } - if (channelSettingsKeys.contains("spectrumConfig.displayHistogram")) { - spectrumSettings.m_displayHistogram = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDisplayHistogram() != 0; - } - if (channelSettingsKeys.contains("spectrumConfig.displayMaxHold")) { - spectrumSettings.m_displayMaxHold = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDisplayMaxHold() != 0; - } - if (channelSettingsKeys.contains("spectrumConfig.displayTraceIntensity")) { - spectrumSettings.m_displayTraceIntensity = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDisplayTraceIntensity(); - } - if (channelSettingsKeys.contains("spectrumConfig.displayWaterfall")) { - spectrumSettings.m_displayWaterfall = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDisplayWaterfall() != 0; - } - if (channelSettingsKeys.contains("spectrumConfig.fftOverlap")) { - spectrumSettings.m_fftOverlap = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getFftOverlap(); - } - if (channelSettingsKeys.contains("spectrumConfig.fftSize")) { - spectrumSettings.m_fftSize = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getFftSize(); - } - if (channelSettingsKeys.contains("spectrumConfig.fpsPeriodMs")) { - spectrumSettings.m_fpsPeriodMs = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getFpsPeriodMs(); - } + if (channelSettingsKeys.contains("spectrumConfig")) { + spectrumSettings.updateFrom(channelSettingsKeys, response.getChannelAnalyzerSettings()->getSpectrumConfig()); } } - -int ChannelAnalyzerWebAPIAdapter::qColorToInt(const QColor& color) -{ - return 256*256*color.blue() + 256*color.green() + color.red(); -} - -QColor ChannelAnalyzerWebAPIAdapter::intToQColor(int intColor) -{ - int r = intColor % 256; - int bg = intColor / 256; - int g = bg % 256; - int b = bg / 256; - return QColor(r, g, b); -} diff --git a/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.h b/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.h index 5080e23e0..1e5475981 100644 --- a/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.h +++ b/plugins/channelrx/chanalyzer/chanalyzerwebapiadapter.h @@ -61,9 +61,6 @@ private: ChannelAnalyzerSettings m_settings; GLScopeSettings m_glScopeSettings; SpectrumSettings m_SpectrumSettings; - - static int qColorToInt(const QColor& color); - static QColor intToQColor(int intColor); }; #endif // INCLUDE_CHANALYZER_WEBAPIADAPTER_H diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index aaa2ea0ba..5720a9a68 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -345,6 +345,9 @@ void BFMDemod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getBfmDemodSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getBfmDemodSettings()->getSpectrumConfig()); + } } int BFMDemod::webapiReportGet( @@ -395,6 +398,20 @@ void BFMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp response.getBfmDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getBfmDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getBfmDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getBfmDemodSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getBfmDemodSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getBfmDemodSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void BFMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -551,6 +568,12 @@ void BFMDemod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgBFMDemodSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgBFMDemodSettings->setSpectrumConfig(swgGLSpectrum); + } } void BFMDemod::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.cpp b/plugins/channelrx/demodbfm/bfmdemodgui.cpp index 07fb00635..b9c64986f 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.cpp +++ b/plugins/channelrx/demodbfm/bfmdemodgui.cpp @@ -104,6 +104,7 @@ bool BFMDemodGUI::handleMessage(const Message& message) const BFMDemod::MsgConfigureBFMDemod& cfg = (BFMDemod::MsgConfigureBFMDemod&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp index 40a53e219..718a8d910 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp +++ b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp @@ -590,6 +590,9 @@ void ChirpChatDemod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getChirpChatDemodSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getChirpChatDemodSettings()->getSpectrumConfig()); + } } int ChirpChatDemod::webapiReportGet( @@ -647,6 +650,20 @@ void ChirpChatDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings response.getChirpChatDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getChirpChatDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getChirpChatDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getChirpChatDemodSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getChirpChatDemodSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getChirpChatDemodSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void ChirpChatDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -799,6 +816,12 @@ void ChirpChatDemod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("title") || force) { swgChirpChatDemodSettings->setTitle(new QString(settings.m_title)); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgChirpChatDemodSettings->setSpectrumConfig(swgGLSpectrum); + } } void ChirpChatDemod::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp index bff8768a3..89e9f6ee1 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp +++ b/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp @@ -115,6 +115,7 @@ bool ChirpChatDemodGUI::handleMessage(const Message& message) const ChirpChatDemod::MsgConfigureChirpChatDemod& cfg = (ChirpChatDemod::MsgConfigureChirpChatDemod&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); diff --git a/plugins/channelrx/demodfreedv/freedvdemod.cpp b/plugins/channelrx/demodfreedv/freedvdemod.cpp index dfdc31691..dbe5d3f2a 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemod.cpp @@ -342,6 +342,9 @@ void FreeDVDemod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getFreeDvDemodSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getFreeDvDemodSettings()->getSpectrumConfig()); + } } int FreeDVDemod::webapiReportGet( @@ -391,6 +394,20 @@ void FreeDVDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r response.getFreeDvDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getFreeDvDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getFreeDvDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getFreeDvDemodSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getFreeDvDemodSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getFreeDvDemodSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void FreeDVDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -501,6 +518,12 @@ void FreeDVDemod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgFreeDVDemodSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgFreeDVDemodSettings->setSpectrumConfig(swgGLSpectrum); + } } void FreeDVDemod::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp index 6b9fabcc8..f835c7134 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp @@ -83,6 +83,7 @@ bool FreeDVDemodGUI::handleMessage(const Message& message) const FreeDVDemod::MsgConfigureFreeDVDemod& cfg = (FreeDVDemod::MsgConfigureFreeDVDemod&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 031abdbda..3a843ee1a 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -417,6 +417,9 @@ void SSBDemod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getSsbDemodSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getSsbDemodSettings()->getSpectrumConfig()); + } } int SSBDemod::webapiReportGet( @@ -473,6 +476,20 @@ void SSBDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp response.getSsbDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getSsbDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getSsbDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getSsbDemodSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getSsbDemodSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getSsbDemodSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void SSBDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -604,6 +621,12 @@ void SSBDemod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgSSBDemodSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgSSBDemodSettings->setSpectrumConfig(swgGLSpectrum); + } } void SSBDemod::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp index 9f5385a9d..98501153b 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.cpp +++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp @@ -69,6 +69,7 @@ bool SSBDemodGUI::handleMessage(const Message& message) const SSBDemod::MsgConfigureSSBDemod& cfg = (SSBDemod::MsgConfigureSSBDemod&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channelrx/filesink/filesink.cpp b/plugins/channelrx/filesink/filesink.cpp index b684f85cd..06f1127ef 100644 --- a/plugins/channelrx/filesink/filesink.cpp +++ b/plugins/channelrx/filesink/filesink.cpp @@ -494,6 +494,9 @@ void FileSink::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("inputFrequencyOffset")) { settings.m_reverseAPIChannelIndex = response.getFileSinkSettings()->getInputFrequencyOffset(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getFileSinkSettings()->getSpectrumConfig()); + } } void FileSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const FileSinkSettings& settings) @@ -532,6 +535,20 @@ void FileSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp response.getFileSinkSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getFileSinkSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getFileSinkSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getFileSinkSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getFileSinkSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getFileSinkSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void FileSink::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -642,6 +659,12 @@ void FileSink::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex")) { swgFileSinkSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgFileSinkSettings->setSpectrumConfig(swgGLSpectrum); + } } void FileSink::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/filesink/filesinkgui.cpp b/plugins/channelrx/filesink/filesinkgui.cpp index cffe35df7..5fe8071b9 100644 --- a/plugins/channelrx/filesink/filesinkgui.cpp +++ b/plugins/channelrx/filesink/filesinkgui.cpp @@ -96,6 +96,7 @@ bool FileSinkGUI::handleMessage(const Message& message) const FileSink::MsgConfigureFileSink& cfg = (FileSink::MsgConfigureFileSink&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->glSpectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channelrx/freqtracker/freqtracker.cpp b/plugins/channelrx/freqtracker/freqtracker.cpp index 74369684f..3cc4d979c 100644 --- a/plugins/channelrx/freqtracker/freqtracker.cpp +++ b/plugins/channelrx/freqtracker/freqtracker.cpp @@ -399,6 +399,9 @@ void FreqTracker::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getFreqTrackerSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getFreqTrackerSettings()->getSpectrumConfig()); + } } int FreqTracker::webapiReportGet( @@ -446,6 +449,20 @@ void FreqTracker::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r response.getFreqTrackerSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getFreqTrackerSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getFreqTrackerSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getFreqTrackerSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getFreqTrackerSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getFreqTrackerSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void FreqTracker::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -568,6 +585,12 @@ void FreqTracker::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgFreqTrackerSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgFreqTrackerSettings->setSpectrumConfig(swgGLSpectrum); + } } void FreqTracker::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/freqtracker/freqtrackergui.cpp b/plugins/channelrx/freqtracker/freqtrackergui.cpp index e6087e708..b15248d3b 100644 --- a/plugins/channelrx/freqtracker/freqtrackergui.cpp +++ b/plugins/channelrx/freqtracker/freqtrackergui.cpp @@ -81,6 +81,7 @@ bool FreqTrackerGUI::handleMessage(const Message& message) const FreqTracker::MsgConfigureFreqTracker& cfg = (FreqTracker::MsgConfigureFreqTracker&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channelrx/sigmffilesink/sigmffilesink.cpp b/plugins/channelrx/sigmffilesink/sigmffilesink.cpp index 6ad1e1eb7..5b0eb566a 100644 --- a/plugins/channelrx/sigmffilesink/sigmffilesink.cpp +++ b/plugins/channelrx/sigmffilesink/sigmffilesink.cpp @@ -494,6 +494,9 @@ void SigMFFileSink::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("inputFrequencyOffset")) { settings.m_reverseAPIChannelIndex = response.getSigMfFileSinkSettings()->getInputFrequencyOffset(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getSigMfFileSinkSettings()->getSpectrumConfig()); + } } void SigMFFileSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const SigMFFileSinkSettings& settings) @@ -532,6 +535,20 @@ void SigMFFileSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response.getSigMfFileSinkSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getSigMfFileSinkSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getSigMfFileSinkSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getSigMfFileSinkSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getSigMfFileSinkSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getSigMfFileSinkSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void SigMFFileSink::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -642,6 +659,12 @@ void SigMFFileSink::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex")) { swgSigMFFileSinkSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgSigMFFileSinkSettings->setSpectrumConfig(swgGLSpectrum); + } } void SigMFFileSink::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp b/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp index 9fd949a31..ae0fd726e 100644 --- a/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp +++ b/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp @@ -95,6 +95,7 @@ bool SigMFFileSinkGUI::handleMessage(const Message& message) const SigMFFileSink::MsgConfigureSigMFFileSink& cfg = (SigMFFileSink::MsgConfigureSigMFFileSink&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->glSpectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channelrx/udpsink/udpsink.cpp b/plugins/channelrx/udpsink/udpsink.cpp index caacc016e..94c5dc5c3 100644 --- a/plugins/channelrx/udpsink/udpsink.cpp +++ b/plugins/channelrx/udpsink/udpsink.cpp @@ -385,6 +385,9 @@ void UDPSink::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getUdpSinkSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getUdpSinkSettings()->getSpectrumConfig()); + } } int UDPSink::webapiReportGet( @@ -443,6 +446,20 @@ void UDPSink::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo response.getUdpSinkSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getUdpSinkSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getUdpSinkSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getUdpSinkSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getUdpSinkSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getUdpSinkSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void UDPSink::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -576,6 +593,12 @@ void UDPSink::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgUDPSinkSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgUDPSinkSettings->setSpectrumConfig(swgGLSpectrum); + } } void UDPSink::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channelrx/udpsink/udpsinkgui.cpp b/plugins/channelrx/udpsink/udpsinkgui.cpp index 731642af7..62a1cc4e6 100644 --- a/plugins/channelrx/udpsink/udpsinkgui.cpp +++ b/plugins/channelrx/udpsink/udpsinkgui.cpp @@ -75,6 +75,7 @@ bool UDPSinkGUI::handleMessage(const Message& message ) const UDPSink::MsgConfigureUDPSink& cfg = (UDPSink::MsgConfigureUDPSink&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channeltx/modfreedv/freedvmod.cpp b/plugins/channeltx/modfreedv/freedvmod.cpp index 46ce34622..6e4e36623 100644 --- a/plugins/channeltx/modfreedv/freedvmod.cpp +++ b/plugins/channeltx/modfreedv/freedvmod.cpp @@ -450,6 +450,9 @@ void FreeDVMod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getFreeDvModSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getFreeDvModSettings()->getSpectrumConfig()); + } } int FreeDVMod::webapiReportGet( @@ -504,6 +507,20 @@ void FreeDVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res response.getFreeDvModSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getFreeDvModSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getFreeDvModSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getFreeDvModSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getFreeDvModSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getFreeDvModSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void FreeDVMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -647,6 +664,12 @@ void FreeDVMod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgFreeDVModSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgFreeDVModSettings->setSpectrumConfig(swgGLSpectrum); + } if (force) { diff --git a/plugins/channeltx/modfreedv/freedvmodgui.cpp b/plugins/channeltx/modfreedv/freedvmodgui.cpp index ceae66418..5d39cbfbf 100644 --- a/plugins/channeltx/modfreedv/freedvmodgui.cpp +++ b/plugins/channeltx/modfreedv/freedvmodgui.cpp @@ -104,6 +104,7 @@ bool FreeDVModGUI::handleMessage(const Message& message) const FreeDVMod::MsgConfigureFreeDVMod& cfg = (FreeDVMod::MsgConfigureFreeDVMod&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index 1a4f3f9d6..0b57a0398 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -521,6 +521,9 @@ void SSBMod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getSsbModSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getSsbModSettings()->getSpectrumConfig()); + } } int SSBMod::webapiReportGet( @@ -582,6 +585,20 @@ void SSBMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon response.getSsbModSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getSsbModSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getSsbModSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getSsbModSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getSsbModSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getSsbModSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void SSBMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -746,6 +763,12 @@ void SSBMod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgSSBModSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgSSBModSettings->setSpectrumConfig(swgGLSpectrum); + } if (force) { diff --git a/plugins/channeltx/modssb/ssbmodgui.cpp b/plugins/channeltx/modssb/ssbmodgui.cpp index 82cc14f91..47832369e 100644 --- a/plugins/channeltx/modssb/ssbmodgui.cpp +++ b/plugins/channeltx/modssb/ssbmodgui.cpp @@ -110,6 +110,7 @@ bool SSBModGUI::handleMessage(const Message& message) } m_settings = mod_settings; blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/channeltx/udpsource/udpsource.cpp b/plugins/channeltx/udpsource/udpsource.cpp index ff20c0596..1277ecbce 100644 --- a/plugins/channeltx/udpsource/udpsource.cpp +++ b/plugins/channeltx/udpsource/udpsource.cpp @@ -418,6 +418,9 @@ void UDPSource::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { settings.m_reverseAPIChannelIndex = response.getUdpSourceSettings()->getReverseApiChannelIndex(); } + if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getUdpSourceSettings()->getSpectrumConfig()); + } } int UDPSource::webapiReportGet( @@ -483,6 +486,20 @@ void UDPSource::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res response.getUdpSourceSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getUdpSourceSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); response.getUdpSourceSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); + + if (settings.m_spectrumGUI) + { + if (response.getUdpSourceSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getUdpSourceSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getUdpSourceSettings()->setSpectrumConfig(swgGLSpectrum); + } + } } void UDPSource::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -623,6 +640,12 @@ void UDPSource::webapiFormatChannelSettings( if (channelSettingsKeys.contains("streamIndex") || force) { swgUDPSourceSettings->setStreamIndex(settings.m_streamIndex); } + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force)) + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgUDPSourceSettings->setSpectrumConfig(swgGLSpectrum); + } } void UDPSource::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/channeltx/udpsource/udpsourcegui.cpp b/plugins/channeltx/udpsource/udpsourcegui.cpp index f3f5339d4..a1f9d0dbe 100644 --- a/plugins/channeltx/udpsource/udpsourcegui.cpp +++ b/plugins/channeltx/udpsource/udpsourcegui.cpp @@ -72,6 +72,7 @@ bool UDPSourceGUI::handleMessage(const Message& message) const UDPSource::MsgConfigureUDPSource& cfg = (UDPSource::MsgConfigureUDPSource&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); displaySettings(); blockApplySettings(false); return true; diff --git a/plugins/feature/demodanalyzer/demodanalyzer.cpp b/plugins/feature/demodanalyzer/demodanalyzer.cpp index 1fce21d84..21ffbd8a5 100644 --- a/plugins/feature/demodanalyzer/demodanalyzer.cpp +++ b/plugins/feature/demodanalyzer/demodanalyzer.cpp @@ -423,6 +423,34 @@ void DemodAnalyzer::webapiFormatFeatureSettings( response.getDemodAnalyzerSettings()->setReverseApiPort(settings.m_reverseAPIPort); response.getDemodAnalyzerSettings()->setReverseApiFeatureSetIndex(settings.m_reverseAPIFeatureSetIndex); response.getDemodAnalyzerSettings()->setReverseApiFeatureIndex(settings.m_reverseAPIFeatureIndex); + + if (settings.m_spectrumGUI) + { + if (response.getDemodAnalyzerSettings()->getSpectrumConfig()) + { + settings.m_spectrumGUI->formatTo(response.getDemodAnalyzerSettings()->getSpectrumConfig()); + } + else + { + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + response.getDemodAnalyzerSettings()->setSpectrumConfig(swgGLSpectrum); + } + } + + if (settings.m_scopeGUI) + { + if (response.getDemodAnalyzerSettings()->getScopeConfig()) + { + settings.m_scopeGUI->formatTo(response.getDemodAnalyzerSettings()->getScopeConfig()); + } + else + { + SWGSDRangel::SWGGLScope *swgGLScope = new SWGSDRangel::SWGGLScope(); + settings.m_scopeGUI->formatTo(swgGLScope); + response.getDemodAnalyzerSettings()->setScopeConfig(swgGLScope); + } + } } void DemodAnalyzer::webapiUpdateFeatureSettings( @@ -454,6 +482,12 @@ void DemodAnalyzer::webapiUpdateFeatureSettings( if (featureSettingsKeys.contains("reverseAPIFeatureIndex")) { settings.m_reverseAPIFeatureIndex = response.getDemodAnalyzerSettings()->getReverseApiFeatureIndex(); } + if (settings.m_spectrumGUI && featureSettingsKeys.contains("spectrumConfig")) { + settings.m_spectrumGUI->updateFrom(featureSettingsKeys, response.getDemodAnalyzerSettings()->getSpectrumConfig()); + } + if (settings.m_scopeGUI && featureSettingsKeys.contains("scopeConfig")) { + settings.m_scopeGUI->updateFrom(featureSettingsKeys, response.getDemodAnalyzerSettings()->getScopeConfig()); + } } void DemodAnalyzer::webapiReverseSendSettings(QList& featureSettingsKeys, const DemodAnalyzerSettings& settings, bool force) diff --git a/plugins/feature/demodanalyzer/demodanalyzergui.cpp b/plugins/feature/demodanalyzer/demodanalyzergui.cpp index 8274db031..7c127338f 100644 --- a/plugins/feature/demodanalyzer/demodanalyzergui.cpp +++ b/plugins/feature/demodanalyzer/demodanalyzergui.cpp @@ -76,6 +76,8 @@ bool DemodAnalyzerGUI::handleMessage(const Message& message) const DemodAnalyzer::MsgConfigureDemodAnalyzer& cfg = (DemodAnalyzer::MsgConfigureDemodAnalyzer&) message; m_settings = cfg.getSettings(); blockApplySettings(true); + ui->spectrumGUI->updateSettings(); + ui->scopeGUI->updateSettings(); displaySettings(); blockApplySettings(false); diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index f7408628c..8d1220c82 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -688,7 +688,6 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur ui->setupUi(this); m_helpURL = "plugins/feature/map/readme.md"; - quint16 port = 0; // Pick a free port // Free keys, so no point in stealing them :) QString tfKey = m_settings.m_thunderforestAPIKey.isEmpty() ? "3e1f614f78a345459931ba3c898e975e" : m_settings.m_thunderforestAPIKey; QString mtKey = m_settings.m_maptilerAPIKey.isEmpty() ? "q2RVNAe3eFKCH4XsrE3r" : m_settings.m_maptilerAPIKey; diff --git a/sdrbase/dsp/channelmarker.cpp b/sdrbase/dsp/channelmarker.cpp index 0b95800a0..a66aed5d3 100644 --- a/sdrbase/dsp/channelmarker.cpp +++ b/sdrbase/dsp/channelmarker.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include "SWGChannelMarker.h" #include "dsp/channelmarker.h" #include "util/simpleserializer.h" @@ -195,6 +196,40 @@ bool ChannelMarker::deserialize(const QByteArray& data) } } +void ChannelMarker::formatTo(SWGSDRangel::SWGObject *swgObject) const +{ + SWGSDRangel::SWGChannelMarker *swgChannelMarker = static_cast(swgObject); + + swgChannelMarker->setCenterFrequency(getCenterFrequency()); + swgChannelMarker->setColor(getColor().rgb()); + swgChannelMarker->setFrequencyScaleDisplayType((int) getFrequencyScaleDisplayType()); + + if (swgChannelMarker->getTitle()) { + *swgChannelMarker->getTitle() = getTitle(); + } else { + swgChannelMarker->setTitle(new QString(getTitle())); + } +} + +void ChannelMarker::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) +{ + SWGSDRangel::SWGChannelMarker *swgChannelMarker = + static_cast(const_cast(swgObject)); + + if (keys.contains("channelMarker.centerFrequency")) { + setCenterFrequency(swgChannelMarker->getCenterFrequency()); + } + if (keys.contains("channelMarker.color")) { + setColor(swgChannelMarker->getColor()); + } + if (keys.contains("channelMarker.frequencyScaleDisplayType")) { + setFrequencyScaleDisplayType((frequencyScaleDisplay_t) swgChannelMarker->getFrequencyScaleDisplayType()); + } + if (keys.contains("channelMarker.title")) { + setTitle(*swgChannelMarker->getTitle()); + } +} + void ChannelMarker::addStreamIndex(int streamIndex) { m_enabledStreamsBits |= (1<getLoop() != 0; - } - if (channelSettingsKeys.contains("cwKeyer.mode")) { - cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode(); - } - if (channelSettingsKeys.contains("cwKeyer.text")) { - cwKeyerSettings.m_text = *apiCwKeyerSettings->getText(); - } - if (channelSettingsKeys.contains("cwKeyer.sampleRate")) { - cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate(); - } - if (channelSettingsKeys.contains("cwKeyer.wpm")) { - cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm(); - } - if (channelSettingsKeys.contains("cwKeyer.keyboardIambic")) { - cwKeyerSettings.m_keyboardIambic = apiCwKeyerSettings->getKeyboardIambic() != 0; - } - if (channelSettingsKeys.contains("cwKeyer.dotKey")) { - cwKeyerSettings.m_dotKey = (Qt::Key) apiCwKeyerSettings->getDotKey(); - } - if (channelSettingsKeys.contains("cwKeyer.dotKeyModifiers")) { - cwKeyerSettings.m_dotKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDotKeyModifiers(); - } - if (channelSettingsKeys.contains("cwKeyer.dashKey")) { - cwKeyerSettings.m_dashKey = (Qt::Key) apiCwKeyerSettings->getDashKey(); - } - if (channelSettingsKeys.contains("cwKeyer.dashKeyModifiers")) { - cwKeyerSettings.m_dashKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDashKeyModifiers(); - } + cwKeyerSettings.updateFrom(channelSettingsKeys, apiCwKeyerSettings); } void CWKeyer::webapiFormatChannelSettings( @@ -651,20 +622,5 @@ void CWKeyer::webapiFormatChannelSettings( const CWKeyerSettings& cwKeyerSettings ) { - apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0); - apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode); - apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate); - - if (apiCwKeyerSettings->getText()) { - *apiCwKeyerSettings->getText() = cwKeyerSettings.m_text; - } else { - apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text)); - } - - apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm); - apiCwKeyerSettings->setKeyboardIambic(cwKeyerSettings.m_keyboardIambic ? 1 : 0); - apiCwKeyerSettings->setDotKey((int) cwKeyerSettings.m_dotKey); - apiCwKeyerSettings->setDotKeyModifiers((unsigned int) cwKeyerSettings.m_dotKeyModifiers); - apiCwKeyerSettings->setDashKey((int) cwKeyerSettings.m_dashKey); - apiCwKeyerSettings->setDashKeyModifiers((unsigned int) cwKeyerSettings.m_dashKeyModifiers); + cwKeyerSettings.formatTo(apiCwKeyerSettings); } diff --git a/sdrbase/dsp/cwkeyersettings.cpp b/sdrbase/dsp/cwkeyersettings.cpp index 307f1bff3..3cee74535 100644 --- a/sdrbase/dsp/cwkeyersettings.cpp +++ b/sdrbase/dsp/cwkeyersettings.cpp @@ -16,6 +16,7 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include "SWGCWKeyerSettings.h" #include "util/simpleserializer.h" #include "cwkeyersettings.h" @@ -95,3 +96,62 @@ bool CWKeyerSettings::deserialize(const QByteArray& data) return false; } } + +void CWKeyerSettings::formatTo(SWGSDRangel::SWGObject *swgObject) const +{ + SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = static_cast(swgObject); + + apiCwKeyerSettings->setLoop(m_loop ? 1 : 0); + apiCwKeyerSettings->setMode((int) m_mode); + apiCwKeyerSettings->setSampleRate(m_sampleRate); + + if (apiCwKeyerSettings->getText()) { + *apiCwKeyerSettings->getText() = m_text; + } else { + apiCwKeyerSettings->setText(new QString(m_text)); + } + + apiCwKeyerSettings->setWpm(m_wpm); + apiCwKeyerSettings->setKeyboardIambic(m_keyboardIambic ? 1 : 0); + apiCwKeyerSettings->setDotKey((int) m_dotKey); + apiCwKeyerSettings->setDotKeyModifiers((unsigned int) m_dotKeyModifiers); + apiCwKeyerSettings->setDashKey((int) m_dashKey); + apiCwKeyerSettings->setDashKeyModifiers((unsigned int) m_dashKeyModifiers); +} + +void CWKeyerSettings::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) +{ + SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = + static_cast(const_cast(swgObject)); + + if (keys.contains("cwKeyer.loop")) { + m_loop = apiCwKeyerSettings->getLoop() != 0; + } + if (keys.contains("cwKeyer.mode")) { + m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode(); + } + if (keys.contains("cwKeyer.text")) { + m_text = *apiCwKeyerSettings->getText(); + } + if (keys.contains("cwKeyer.sampleRate")) { + m_sampleRate = apiCwKeyerSettings->getSampleRate(); + } + if (keys.contains("cwKeyer.wpm")) { + m_wpm = apiCwKeyerSettings->getWpm(); + } + if (keys.contains("cwKeyer.keyboardIambic")) { + m_keyboardIambic = apiCwKeyerSettings->getKeyboardIambic() != 0; + } + if (keys.contains("cwKeyer.dotKey")) { + m_dotKey = (Qt::Key) apiCwKeyerSettings->getDotKey(); + } + if (keys.contains("cwKeyer.dotKeyModifiers")) { + m_dotKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDotKeyModifiers(); + } + if (keys.contains("cwKeyer.dashKey")) { + m_dashKey = (Qt::Key) apiCwKeyerSettings->getDashKey(); + } + if (keys.contains("cwKeyer.dashKeyModifiers")) { + m_dashKeyModifiers = (Qt::KeyboardModifiers) apiCwKeyerSettings->getDashKeyModifiers(); + } +} diff --git a/sdrbase/dsp/cwkeyersettings.h b/sdrbase/dsp/cwkeyersettings.h index f59beafa3..5391b5289 100644 --- a/sdrbase/dsp/cwkeyersettings.h +++ b/sdrbase/dsp/cwkeyersettings.h @@ -23,8 +23,9 @@ #include #include "export.h" +#include "settings/serializable.h" -class SDRBASE_API CWKeyerSettings +class SDRBASE_API CWKeyerSettings: public Serializable { public: typedef enum @@ -52,6 +53,8 @@ public: QByteArray serialize() const; bool deserialize(const QByteArray& data); + virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const; + virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject); }; diff --git a/sdrbase/dsp/glscopesettings.cpp b/sdrbase/dsp/glscopesettings.cpp index 8c1cf1478..0583b036f 100644 --- a/sdrbase/dsp/glscopesettings.cpp +++ b/sdrbase/dsp/glscopesettings.cpp @@ -15,9 +15,13 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include + #include "util/simpleserializer.h" #include "glscopesettings.h" +#include "SWGGLScope.h" + const double GLScopeSettings::AMPS[27] = { 2e-1, 1e-1, 5e-2, 2e-2, 1e-2, 5e-3, @@ -39,20 +43,14 @@ GLScopeSettings::GLScopeSettings(const GLScopeSettings& t) { resetToDefaults(); - for (unsigned int i = 0; i < m_maxNbTraces; i++) { - m_tracesData[i] = t.m_tracesData[i]; - } - - for (unsigned int i = 0; i < m_maxNbTriggers; i++) { - m_triggersData[i] = t.m_triggersData[i]; - } - + m_tracesData = t.m_tracesData; + m_triggersData = t.m_triggersData; m_displayMode = t.m_displayMode; m_traceIntensity = t.m_traceIntensity; m_gridIntensity = t.m_gridIntensity; m_time = t.m_time; m_timeOfs = t.m_timeOfs; - m_traceLen = t.m_traceLen; + m_traceLenMult = t.m_traceLenMult; m_trigPre = t.m_trigPre; } @@ -66,7 +64,7 @@ void GLScopeSettings::resetToDefaults() m_gridIntensity = 10; m_time = 1; m_timeOfs = 0; - m_traceLen = 1; + m_traceLenMult = 1; m_trigPre = 0; } @@ -80,7 +78,7 @@ QByteArray GLScopeSettings::serialize() const s.writeS32(3, m_gridIntensity); s.writeS32(4, m_time); // s.writeS32(5, m_timeOfs); - s.writeS32(6, m_traceLen); + s.writeS32(6, m_traceLenMult); std::vector::const_iterator traceDataIt = m_tracesData.begin(); unsigned int i = 0; @@ -149,7 +147,7 @@ bool GLScopeSettings::deserialize(const QByteArray& data) d.readS32(3, &m_gridIntensity, 10); d.readS32(4, &m_time, 1); // d.readS32(5, &m_timeOfs, 0); - d.readS32(6, &m_traceLen, 1); + d.readS32(6, &m_traceLenMult, 1); d.readS32(201, &m_trigPre, 0); uint32_t nbTracesSaved; @@ -234,27 +232,263 @@ bool GLScopeSettings::deserialize(const QByteArray& data) } } +void GLScopeSettings::formatTo(SWGSDRangel::SWGObject *swgObject) const +{ + SWGSDRangel::SWGGLScope *swgScope = static_cast(swgObject); + + swgScope->setDisplayMode(m_displayMode); + swgScope->setGridIntensity(m_gridIntensity); + swgScope->setTime(m_time); + swgScope->setTimeOfs(m_timeOfs); + swgScope->setTraceIntensity(m_traceIntensity); + swgScope->setTraceLenMult(m_traceLenMult); + swgScope->setTrigPre(m_trigPre); + + // array of traces + swgScope->setTracesData(new QList); + std::vector::const_iterator traceIt = m_tracesData.begin(); + + for (; traceIt != m_tracesData.end(); ++traceIt) + { + swgScope->getTracesData()->append(new SWGSDRangel::SWGTraceData); + swgScope->getTracesData()->back()->setStreamIndex(traceIt->m_streamIndex); + swgScope->getTracesData()->back()->setAmp(traceIt->m_amp); + swgScope->getTracesData()->back()->setHasTextOverlay(traceIt->m_hasTextOverlay ? 1 : 0); + swgScope->getTracesData()->back()->setStreamIndex(traceIt->m_streamIndex); + swgScope->getTracesData()->back()->setOfs(traceIt->m_ofs); + swgScope->getTracesData()->back()->setProjectionType((int) traceIt->m_projectionType); + swgScope->getTracesData()->back()->setTextOverlay(new QString(traceIt->m_textOverlay)); + swgScope->getTracesData()->back()->setTraceColor(qColorToInt(traceIt->m_traceColor)); + swgScope->getTracesData()->back()->setTraceColorB(traceIt->m_traceColorB); + swgScope->getTracesData()->back()->setTraceColorG(traceIt->m_traceColorG); + swgScope->getTracesData()->back()->setTraceColorR(traceIt->m_traceColorR); + swgScope->getTracesData()->back()->setTraceDelay(traceIt->m_traceDelay); + swgScope->getTracesData()->back()->setTraceDelayCoarse(traceIt->m_traceDelayCoarse); + swgScope->getTracesData()->back()->setTraceDelayFine(traceIt->m_traceDelayFine); + swgScope->getTracesData()->back()->setTriggerDisplayLevel(traceIt->m_triggerDisplayLevel); + swgScope->getTracesData()->back()->setViewTrace(traceIt->m_viewTrace ? 1 : 0); + } + + // array of triggers + swgScope->setTriggersData(new QList); + std::vector::const_iterator triggerIt = m_triggersData.begin(); + + for (; triggerIt != m_triggersData.end(); ++triggerIt) + { + swgScope->getTriggersData()->append(new SWGSDRangel::SWGTriggerData); + swgScope->getTriggersData()->back()->setStreamIndex(triggerIt->m_streamIndex); + swgScope->getTriggersData()->back()->setInputIndex(triggerIt->m_inputIndex); + swgScope->getTriggersData()->back()->setProjectionType((int) triggerIt->m_projectionType); + swgScope->getTriggersData()->back()->setTriggerBothEdges(triggerIt->m_triggerBothEdges ? 1 : 0); + swgScope->getTriggersData()->back()->setTriggerColor(qColorToInt(triggerIt->m_triggerColor)); + swgScope->getTriggersData()->back()->setTriggerColorB(triggerIt->m_triggerColorB); + swgScope->getTriggersData()->back()->setTriggerColorG(triggerIt->m_triggerColorG); + swgScope->getTriggersData()->back()->setTriggerColorR(triggerIt->m_triggerColorR); + swgScope->getTriggersData()->back()->setTriggerDelay(triggerIt->m_triggerDelay); + swgScope->getTriggersData()->back()->setTriggerDelayCoarse(triggerIt->m_triggerDelayCoarse); + swgScope->getTriggersData()->back()->setTriggerDelayFine(triggerIt->m_triggerDelayFine); + swgScope->getTriggersData()->back()->setTriggerDelayMult(triggerIt->m_triggerDelayMult); + swgScope->getTriggersData()->back()->setTriggerHoldoff(triggerIt->m_triggerHoldoff ? 1 : 0); + swgScope->getTriggersData()->back()->setTriggerLevel(triggerIt->m_triggerLevel); + swgScope->getTriggersData()->back()->setTriggerLevelCoarse(triggerIt->m_triggerLevelCoarse); + swgScope->getTriggersData()->back()->setTriggerLevelFine(triggerIt->m_triggerLevelFine); + swgScope->getTriggersData()->back()->setTriggerPositiveEdge(triggerIt->m_triggerPositiveEdge ? 1 : 0); + swgScope->getTriggersData()->back()->setTriggerRepeat(triggerIt->m_triggerRepeat); + } +} + +void GLScopeSettings::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) +{ + SWGSDRangel::SWGGLScope *swgScope = + static_cast(const_cast(swgObject)); + + if (keys.contains("scopeConfig.displayMode")) { + m_displayMode = (GLScopeSettings::DisplayMode) swgScope->getDisplayMode(); + } + if (keys.contains("scopeConfig.gridIntensity")) { + m_gridIntensity = swgScope->getGridIntensity(); + } + if (keys.contains("scopeConfig.time")) { + m_time = swgScope->getTime(); + } + if (keys.contains("scopeConfig.timeOfs")) { + m_timeOfs = swgScope->getTimeOfs(); + } + if (keys.contains("scopeConfig.traceIntensity")) { + m_traceIntensity = swgScope->getTraceIntensity(); + } + if (keys.contains("scopeConfig.traceLenMult")) { + m_traceLenMult = swgScope->getTraceLenMult(); + } + if (keys.contains("scopeConfig.trigPre")) { + m_trigPre = swgScope->getTrigPre(); + } + // traces + if (keys.contains("scopeConfig.tracesData")) + { + QList *tracesData = swgScope->getTracesData(); + m_tracesData.clear(); + + for (int i = 0; i < 10; i++) // no more than 10 traces anyway + { + if (keys.contains(QString("scopeConfig.tracesData[%1]").arg(i))) + { + SWGSDRangel::SWGTraceData *traceData = tracesData->at(i); + m_tracesData.push_back(GLScopeSettings::TraceData()); + + if (keys.contains(QString("scopeConfig.tracesData[%1].streamIndex").arg(i))) { + m_tracesData.back().m_streamIndex = traceData->getStreamIndex(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].amp").arg(i))) { + m_tracesData.back().m_amp = traceData->getAmp(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].hasTextOverlay").arg(i))) { + m_tracesData.back().m_hasTextOverlay = traceData->getHasTextOverlay() != 0; + } + if (keys.contains(QString("scopeConfig.tracesData[%1].inputIndex").arg(i))) { + m_tracesData.back().m_streamIndex = traceData->getStreamIndex(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].ofs").arg(i))) { + m_tracesData.back().m_ofs = traceData->getOfs(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].projectionType").arg(i))) { + m_tracesData.back().m_projectionType = (Projector::ProjectionType) traceData->getProjectionType(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].traceColor").arg(i))) { + m_tracesData.back().m_traceColor = intToQColor(traceData->getTraceColor()); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].traceColorB").arg(i))) { + m_tracesData.back().m_traceColorB = traceData->getTraceColorB(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].traceColorG").arg(i))) { + m_tracesData.back().m_traceColorG = traceData->getTraceColorG(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].traceColorR").arg(i))) { + m_tracesData.back().m_traceColorR = traceData->getTraceColorR(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].traceDelay").arg(i))) { + m_tracesData.back().m_traceDelay = traceData->getTraceDelay(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].traceDelayCoarse").arg(i))) { + m_tracesData.back().m_traceDelayCoarse = traceData->getTraceDelayCoarse(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].traceDelayFine").arg(i))) { + m_tracesData.back().m_traceDelayFine = traceData->getTraceDelayFine(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].triggerDisplayLevel").arg(i))) { + m_tracesData.back().m_triggerDisplayLevel = traceData->getTriggerDisplayLevel(); + } + if (keys.contains(QString("scopeConfig.tracesData[%1].viewTrace").arg(i))) { + m_tracesData.back().m_viewTrace = traceData->getViewTrace() != 0; + } + } + else + { + break; + } + } + } + // triggers + if (keys.contains("scopeConfig.triggersData")) + { + QList *triggersData = swgScope->getTriggersData(); + m_triggersData.clear(); + + for (int i = 0; i < 10; i++) // no more than 10 triggers anyway + { + if (keys.contains(QString("scopeConfig.triggersData[%1]").arg(i))) + { + SWGSDRangel::SWGTriggerData *triggerData = triggersData->at(i); + m_triggersData.push_back(GLScopeSettings::TriggerData()); + + if (keys.contains(QString("scopeConfig.triggersData[%1].streamIndex").arg(i))) { + m_triggersData.back().m_streamIndex = triggerData->getStreamIndex(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].inputIndex").arg(i))) { + m_triggersData.back().m_inputIndex = triggerData->getInputIndex(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].projectionType").arg(i))) { + m_triggersData.back().m_projectionType = (Projector::ProjectionType) triggerData->getProjectionType(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerBothEdges").arg(i))) { + m_triggersData.back().m_triggerBothEdges = triggerData->getTriggerBothEdges() != 0; + } + if (keys.contains(QString("scopeConfig.tracesData[%1].triggerColor").arg(i))) { + m_tracesData.back().m_traceColor = intToQColor(triggerData->getTriggerColor()); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerColorB").arg(i))) { + m_triggersData.back().m_triggerColorB = triggerData->getTriggerColorB(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerColorG").arg(i))) { + m_triggersData.back().m_triggerColorG = triggerData->getTriggerColorG(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerColorR").arg(i))) { + m_triggersData.back().m_triggerColorR = triggerData->getTriggerColorR(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerDelay").arg(i))) { + m_triggersData.back().m_triggerDelay = triggerData->getTriggerDelay(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerDelayCoarse").arg(i))) { + m_triggersData.back().m_triggerDelayCoarse = triggerData->getTriggerDelayCoarse(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerDelayFine").arg(i))) { + m_triggersData.back().m_triggerDelayFine = triggerData->getTriggerDelayFine(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerDelayMult").arg(i))) { + m_triggersData.back().m_triggerDelayMult = triggerData->getTriggerDelayMult(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerHoldoff").arg(i))) { + m_triggersData.back().m_triggerHoldoff = triggerData->getTriggerHoldoff(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerLevel").arg(i))) { + m_triggersData.back().m_triggerLevel = triggerData->getTriggerLevel(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerLevelCoarse").arg(i))) { + m_triggersData.back().m_triggerLevelCoarse = triggerData->getTriggerLevelCoarse(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerLevelFine").arg(i))) { + m_triggersData.back().m_triggerLevelFine = triggerData->getTriggerLevelFine(); + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerPositiveEdge").arg(i))) { + m_triggersData.back().m_triggerPositiveEdge = triggerData->getTriggerPositiveEdge() != 0; + } + if (keys.contains(QString("scopeConfig.triggersData[%1].triggerRepeat").arg(i))) { + m_triggersData.back().m_triggerRepeat = triggerData->getTriggerRepeat() != 0; + } + } + } + } +} + GLScopeSettings& GLScopeSettings::operator=(const GLScopeSettings& t) { // Check for self assignment if (this != &t) { - for (unsigned int i = 0; i < m_maxNbTraces; i++) { - m_tracesData[i] = t.m_tracesData[i]; - } - - for (unsigned int i = 0; i < m_maxNbTriggers; i++) { - m_triggersData[i] = t.m_triggersData[i]; - } - + m_tracesData = t.m_tracesData; + m_triggersData = t.m_triggersData; m_displayMode = t.m_displayMode; m_traceIntensity = t.m_traceIntensity; m_gridIntensity = t.m_gridIntensity; m_time = t.m_time; m_timeOfs = t.m_timeOfs; - m_traceLen = t.m_traceLen; + m_traceLenMult = t.m_traceLenMult; m_trigPre = t.m_trigPre; } return *this; } + +int GLScopeSettings::qColorToInt(const QColor& color) +{ + return 256*256*color.blue() + 256*color.green() + color.red(); +} + +QColor GLScopeSettings::intToQColor(int intColor) +{ + int r = intColor % 256; + int bg = intColor / 256; + int g = bg % 256; + int b = bg / 256; + return QColor(r, g, b); +} diff --git a/sdrbase/dsp/glscopesettings.h b/sdrbase/dsp/glscopesettings.h index 257123374..7fbcce431 100644 --- a/sdrbase/dsp/glscopesettings.h +++ b/sdrbase/dsp/glscopesettings.h @@ -152,7 +152,7 @@ public: int m_gridIntensity; int m_time; int m_timeOfs; - int m_traceLen; + int m_traceLenMult; int m_trigPre; std::vector m_tracesData; std::vector m_triggersData; @@ -171,8 +171,11 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const; + virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject); GLScopeSettings& operator=(const GLScopeSettings& t); - + static int qColorToInt(const QColor& color); + static QColor intToQColor(int intColor); }; #endif // SDRBASE_DSP_GLSCOPESETTINGS_H diff --git a/sdrbase/dsp/scopevis.cpp b/sdrbase/dsp/scopevis.cpp index 113b993b0..a5a276936 100644 --- a/sdrbase/dsp/scopevis.cpp +++ b/sdrbase/dsp/scopevis.cpp @@ -159,7 +159,7 @@ void ScopeVis::configure( if (m_traceSize != traceSize) { setTraceSize(traceSize); - m_settings.m_traceLen = traceSize; + m_settings.m_traceLenMult = traceSize / getTraceChunkSize(); m_triggerState = TriggerUntriggered; m_traces.resetControls(); } @@ -1120,9 +1120,9 @@ void ScopeVis::applySettings(const GLScopeSettings& settings, bool force) for (unsigned int i = 0; i < m_settings.m_tracesData.size(); i++) { if (i < m_traces.size()) { // change trace - changeTrace(m_settings.m_tracesData[i], i); + changeTrace(settings.m_tracesData[i], i); } else { // add trace - addTrace(m_settings.m_tracesData[i]); + addTrace(settings.m_tracesData[i]); } } diff --git a/sdrbase/dsp/spectrumsettings.cpp b/sdrbase/dsp/spectrumsettings.cpp index cedd876d9..357353514 100644 --- a/sdrbase/dsp/spectrumsettings.cpp +++ b/sdrbase/dsp/spectrumsettings.cpp @@ -15,6 +15,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include "SWGGLSpectrum.h" + #include "util/simpleserializer.h" #include "spectrumsettings.h" @@ -53,6 +55,7 @@ void SpectrumSettings::resetToDefaults() m_linear = false; m_ssb = false; m_usb = true; + m_wsSpectrum = false; m_wsSpectrumAddress = "127.0.0.1"; m_wsSpectrumPort = 8887; } @@ -86,6 +89,7 @@ QByteArray SpectrumSettings::serialize() const s.writeBool(24, m_ssb); s.writeBool(25, m_usb); s.writeS32(26, m_fpsPeriodMs); + s.writeBool(27, m_wsSpectrum); s.writeS32(100, m_histogramMarkers.size()); for (int i = 0; i < m_histogramMarkers.size(); i++) { @@ -146,6 +150,7 @@ bool SpectrumSettings::deserialize(const QByteArray& data) d.readBool(24, &m_ssb, false); d.readBool(25, &m_usb, true); d.readS32(26, &tmp, 50); + d.readBool(27, &m_wsSpectrum, false); m_fpsPeriodMs = tmp < 5 ? 5 : tmp > 500 ? 500 : tmp; int histogramMarkersSize; @@ -186,6 +191,122 @@ bool SpectrumSettings::deserialize(const QByteArray& data) } } +void SpectrumSettings::formatTo(SWGSDRangel::SWGObject *swgObject) const +{ + SWGSDRangel::SWGGLSpectrum *swgSpectrum = static_cast(swgObject); + + swgSpectrum->setFftWindow((int) m_fftWindow); + swgSpectrum->setFftSize(m_fftSize); + swgSpectrum->setFftOverlap(m_fftOverlap); + swgSpectrum->setAveragingMode((int) m_averagingMode); + swgSpectrum->setAveragingValue(SpectrumSettings::getAveragingValue(m_averagingIndex, m_averagingMode)); + swgSpectrum->setRefLevel(m_refLevel); + swgSpectrum->setPowerRange(m_powerRange); + swgSpectrum->setFpsPeriodMs(m_fpsPeriodMs); + swgSpectrum->setLinear(m_linear ? 1 : 0); + swgSpectrum->setWsSpectrum(m_wsSpectrum ? 1 : 0); + swgSpectrum->setWsSpectrumPort(m_wsSpectrumPort); + + if (swgSpectrum->getWsSpectrumAddress()) { + *swgSpectrum->getWsSpectrumAddress() = m_wsSpectrumAddress; + } else { + swgSpectrum->setWsSpectrumAddress(new QString(m_wsSpectrumAddress)); + } + + swgSpectrum->setDisplayHistogram(m_displayHistogram ? 1 : 0); + swgSpectrum->setDecay(m_decay); + swgSpectrum->setDecayDivisor(m_decayDivisor); + swgSpectrum->setHistogramStroke(m_histogramStroke); + swgSpectrum->setDisplayMaxHold(m_displayMaxHold ? 1 : 0); + swgSpectrum->setDisplayCurrent(m_displayCurrent ? 1 : 0); + swgSpectrum->setDisplayTraceIntensity(m_displayTraceIntensity); + swgSpectrum->setInvertedWaterfall(m_invertedWaterfall ? 1 : 0); + swgSpectrum->setDisplayWaterfall(m_displayWaterfall ? 1 : 0); + swgSpectrum->setDisplayGrid(m_displayGrid ? 1 : 0); + swgSpectrum->setDisplayGridIntensity(m_displayGridIntensity); +} + +void SpectrumSettings::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) +{ + SWGSDRangel::SWGGLSpectrum *swgSpectrum = + static_cast(const_cast(swgObject)); + + if (keys.contains("spectrumConfig.fftWindow")) { + m_fftWindow = (FFTWindow::Function) swgSpectrum->getFftWindow(); + } + if (keys.contains("spectrumConfig.fftSize")) { + m_fftSize = swgSpectrum->getFftSize(); + } + if (keys.contains("spectrumConfig.fftOverlap")) { + m_fftOverlap = swgSpectrum->getFftOverlap(); + } + if (keys.contains("spectrumConfig.averagingMode")) { + m_averagingMode = (SpectrumSettings::AveragingMode) swgSpectrum->getAveragingMode(); + } + if (keys.contains("spectrumConfig.averagingValue")) + { + m_averagingValue = swgSpectrum->getAveragingValue(); + m_averagingIndex = SpectrumSettings::getAveragingIndex(m_averagingValue, m_averagingMode); + } + if (keys.contains("spectrumConfig.refLevel")) { + m_refLevel = swgSpectrum->getRefLevel(); + } + if (keys.contains("spectrumConfig.powerRange")) { + m_powerRange = swgSpectrum->getPowerRange(); + } + if (keys.contains("spectrumConfig.fpsPeriodMs")) { + m_fpsPeriodMs = swgSpectrum->getFpsPeriodMs(); + } + if (keys.contains("spectrumConfig.linear")) { + m_linear = swgSpectrum->getLinear() != 0; + } + if (keys.contains("spectrumConfig.wsSpectrum")) { + m_wsSpectrum = swgSpectrum->getWsSpectrum() != 0; + } + if (keys.contains("spectrumConfig.wsSpectrum")) { + m_wsSpectrum = swgSpectrum->getWsSpectrum() != 0; + } + if (keys.contains("spectrumConfig.wsSpectrumAddress")) { + m_wsSpectrumAddress = *swgSpectrum->getWsSpectrumAddress(); + } + if (keys.contains("spectrumConfig.wsSpectrumPort")) { + m_wsSpectrumPort = swgSpectrum->getWsSpectrumPort(); + } + if (keys.contains("spectrumConfig.displayHistogram")) { + m_displayHistogram = swgSpectrum->getDisplayHistogram() != 0; + } + if (keys.contains("spectrumConfig.decay")) { + m_decay = swgSpectrum->getDecay(); + } + if (keys.contains("spectrumConfig.decayDivisor")) { + m_decayDivisor = swgSpectrum->getDecayDivisor(); + } + if (keys.contains("spectrumConfig.histogramStroke")) { + m_histogramStroke = swgSpectrum->getHistogramStroke(); + } + if (keys.contains("spectrumConfig.displayMaxHold")) { + m_displayMaxHold = swgSpectrum->getDisplayMaxHold() != 0; + } + if (keys.contains("spectrumConfig.displayCurrent")) { + m_displayCurrent = swgSpectrum->getDisplayCurrent() != 0; + } + if (keys.contains("spectrumConfig.displayTraceIntensity")) { + m_displayTraceIntensity = swgSpectrum->getDisplayTraceIntensity(); + } + if (keys.contains("spectrumConfig.invertedWaterfall")) { + m_invertedWaterfall = swgSpectrum->getInvertedWaterfall() != 0; + } + if (keys.contains("spectrumConfig.displayWaterfall")) { + m_displayWaterfall = swgSpectrum->getDisplayWaterfall() != 0; + } + if (keys.contains("spectrumConfig.displayGrid")) { + m_displayGrid = swgSpectrum->getDisplayGrid() != 0; + } + if (keys.contains("spectrumConfig.displayGridIntensity")) { + m_displayGridIntensity = swgSpectrum->getDisplayGridIntensity(); + } +} + int SpectrumSettings::getAveragingMaxScale(AveragingMode averagingMode) { if (averagingMode == AvgModeMoving) { diff --git a/sdrbase/dsp/spectrumsettings.h b/sdrbase/dsp/spectrumsettings.h index ea220d0a8..28098b98c 100644 --- a/sdrbase/dsp/spectrumsettings.h +++ b/sdrbase/dsp/spectrumsettings.h @@ -68,8 +68,9 @@ public: bool m_linear; //!< linear else logarithmic scale bool m_ssb; //!< SSB display with spectrum center at start of array or display - else spectrum center is on center bool m_usb; //!< USB display with increasing frequencies towads the right - else decreasing frequencies - QString m_wsSpectrumAddress; - uint16_t m_wsSpectrumPort; + bool m_wsSpectrum; //!< Start or stop websocket spectrum server + QString m_wsSpectrumAddress; //!< websocket spectrum server address + uint16_t m_wsSpectrumPort; //!< websocket spectrum server port QList m_histogramMarkers; QList m_waterfallMarkers; static const int m_log2FFTSizeMin = 6; // 64 @@ -81,6 +82,8 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const; + virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject); QList& getHistogramMarkers() { return m_histogramMarkers; } QList& getWaterfallMarkers() { return m_waterfallMarkers; } diff --git a/sdrbase/resources/webapi.qrc b/sdrbase/resources/webapi.qrc index e7eb68f21..ce5cf9947 100644 --- a/sdrbase/resources/webapi.qrc +++ b/sdrbase/resources/webapi.qrc @@ -24,6 +24,7 @@ webapi/doc/swagger/include/BladeRF2.yaml webapi/doc/swagger/include/ChannelActions.yaml webapi/doc/swagger/include/ChannelAnalyzer.yaml + webapi/doc/swagger/include/ChannelMarker.yaml webapi/doc/swagger/include/ChannelSettings.yaml webapi/doc/swagger/include/ChannelReport.yaml webapi/doc/swagger/include/ChirpChatDemod.yaml diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 5ac129b21..d536feb69 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -2325,6 +2325,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "BFMDemod" @@ -3003,6 +3006,9 @@ margin-bottom: 20px; }, "scopeConfig" : { "$ref" : "#/definitions/GLScope" + }, + "channelMarker" : { + "$ref" : "#/definitions/ChannelMarker" } }, "description" : "ChannelAnalyzer" @@ -3048,6 +3054,25 @@ margin-bottom: 20px; } }, "description" : "Summarized information about channel plugin" +}; + defs.ChannelMarker = { + "properties" : { + "centerFrequency" : { + "type" : "integer" + }, + "color" : { + "type" : "integer", + "description" : "RGB color" + }, + "title" : { + "type" : "string" + }, + "frequencyScaleDisplayType" : { + "type" : "integer", + "description" : "ChannelMarker::frequencyScaleDisplay_t" + } + }, + "description" : "ChannelMarker settings" }; defs.ChannelReport = { "required" : [ "direction" ], @@ -3536,6 +3561,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "ChirpChatDemod" @@ -5395,6 +5423,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FileSink" @@ -5575,6 +5606,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FreeDVDemod" @@ -5658,6 +5692,9 @@ margin-bottom: 20px; }, "cwKeyer" : { "$ref" : "#/definitions/CWKeyerSettings" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FreeDVMod" @@ -5763,6 +5800,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FreqTracker" @@ -5827,8 +5867,9 @@ margin-bottom: 20px; "timeOfs" : { "type" : "integer" }, - "traceLen" : { - "type" : "integer" + "traceLenMult" : { + "type" : "integer", + "description" : "Trace length multiplier (multiplies 4800 samples)" }, "trigPre" : { "type" : "integer" @@ -5934,6 +5975,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "boolean" }, + "wsSpectrum" : { + "type" : "integer", + "description" : "Boolean - Start or stop websocket server\n * 0 - Stop server\n * 1 - Start server\n" + }, "wsSpectrumAddress" : { "type" : "string", "description" : "IPv4 address of interface the websocket server is listening to" @@ -10304,6 +10349,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "SSBDemod" @@ -10410,6 +10458,9 @@ margin-bottom: 20px; }, "cwKeyer" : { "$ref" : "#/definitions/CWKeyerSettings" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "SSBMod" @@ -10954,6 +11005,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "SigMFFileSink" @@ -12201,6 +12255,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "UDPSink" @@ -12326,6 +12383,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "UDPSource" @@ -51387,7 +51447,7 @@ except ApiException as e:
- Generated 2021-11-24T06:35:35.789+01:00 + Generated 2021-11-30T22:42:47.179+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml index 8fc44c981..e250b84c7 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml @@ -44,6 +44,8 @@ BFMDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" BFMDemodReport: description: BFMDemod diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelAnalyzer.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelAnalyzer.yaml index 06b3b0749..7f7b720e4 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelAnalyzer.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelAnalyzer.yaml @@ -54,3 +54,5 @@ ChannelAnalyzerSettings: $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" scopeConfig: $ref: "/doc/swagger/include/GLScope.yaml#/GLScope" + channelMarker: + $ref: "/doc/swagger/include/ChannelMarker.yaml#/ChannelMarker" diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelMarker.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelMarker.yaml new file mode 100644 index 000000000..328397aaf --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelMarker.yaml @@ -0,0 +1,13 @@ +ChannelMarker: + description: ChannelMarker settings + properties: + centerFrequency: + type: integer + color: + type: integer + description: RGB color + title: + type: string + frequencyScaleDisplayType: + type: integer + description: ChannelMarker::frequencyScaleDisplay_t diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChirpChatDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChirpChatDemod.yaml index 278108bb3..4d1dcd50a 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChirpChatDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChirpChatDemod.yaml @@ -118,6 +118,8 @@ ChirpChatDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" ChirpChatDemodReport: description: ChirpChatDemod diff --git a/sdrbase/resources/webapi/doc/swagger/include/FileSink.yaml b/sdrbase/resources/webapi/doc/swagger/include/FileSink.yaml index 1f8f1423e..d25f62bde 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/FileSink.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/FileSink.yaml @@ -48,6 +48,8 @@ FileSinkSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" FileSinkReport: description: FileSink diff --git a/sdrbase/resources/webapi/doc/swagger/include/FreeDVDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/FreeDVDemod.yaml index 072085c1d..70e5ab594 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/FreeDVDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/FreeDVDemod.yaml @@ -42,6 +42,8 @@ FreeDVDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" FreeDVDemodReport: description: FreeDVDemod diff --git a/sdrbase/resources/webapi/doc/swagger/include/FreeDVMod.yaml b/sdrbase/resources/webapi/doc/swagger/include/FreeDVMod.yaml index 0ec6d1c6f..879aeb616 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/FreeDVMod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/FreeDVMod.yaml @@ -44,6 +44,8 @@ FreeDVModSettings: type: integer cwKeyer: $ref: "/doc/swagger/include/CWKeyer.yaml#/CWKeyerSettings" + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" FreeDVModReport: description: FreeDVMod diff --git a/sdrbase/resources/webapi/doc/swagger/include/FreqTracker.yaml b/sdrbase/resources/webapi/doc/swagger/include/FreqTracker.yaml index 5d507b162..2607619bd 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/FreqTracker.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/FreqTracker.yaml @@ -57,6 +57,8 @@ FreqTrackerSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" FreqTrackerReport: description: FreqTracker diff --git a/sdrbase/resources/webapi/doc/swagger/include/GLScope.yaml b/sdrbase/resources/webapi/doc/swagger/include/GLScope.yaml index a410f8cc2..3a142ca91 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/GLScope.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/GLScope.yaml @@ -129,8 +129,9 @@ GLScope: type: integer timeOfs: type: integer - traceLen: + traceLenMult: type: integer + description: Trace length multiplier (multiplies 4800 samples) trigPre: type: integer tracesData: diff --git a/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml b/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml index f61a40efe..d931dc488 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml @@ -62,6 +62,12 @@ GLSpectrum: usb: description: boolean type: integer + wsSpectrum: + type: integer + description: > + Boolean - Start or stop websocket server + * 0 - Stop server + * 1 - Start server wsSpectrumAddress: description: IPv4 address of interface the websocket server is listening to type: string diff --git a/sdrbase/resources/webapi/doc/swagger/include/SSBDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/SSBDemod.yaml index 1879d5e96..0c4bca4a2 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/SSBDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/SSBDemod.yaml @@ -62,6 +62,8 @@ SSBDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" SSBDemodReport: description: SSBDemod diff --git a/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml b/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml index 103cd9bee..edd6f1ecc 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/SSBMod.yaml @@ -60,6 +60,8 @@ SSBModSettings: type: integer cwKeyer: $ref: "/doc/swagger/include/CWKeyer.yaml#/CWKeyerSettings" + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" SSBModReport: description: SSBMod diff --git a/sdrbase/resources/webapi/doc/swagger/include/SigMFFileSink.yaml b/sdrbase/resources/webapi/doc/swagger/include/SigMFFileSink.yaml index e64f0e0cc..8fa12e57e 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/SigMFFileSink.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/SigMFFileSink.yaml @@ -48,6 +48,8 @@ SigMFFileSinkSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" SigMFFileSinkReport: description: SigMFFileSink diff --git a/sdrbase/resources/webapi/doc/swagger/include/UDPSink.yaml b/sdrbase/resources/webapi/doc/swagger/include/UDPSink.yaml index 1e7800d15..ceb1dd0d0 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/UDPSink.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/UDPSink.yaml @@ -69,6 +69,8 @@ UDPSinkSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" UDPSinkReport: description: UDPSink diff --git a/sdrbase/resources/webapi/doc/swagger/include/UDPSource.yaml b/sdrbase/resources/webapi/doc/swagger/include/UDPSource.yaml index 641de4ddc..b29337b7d 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/UDPSource.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/UDPSource.yaml @@ -71,6 +71,8 @@ UDPSourceSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum" UDPSourceReport: description: UDPSource diff --git a/sdrbase/settings/serializable.h b/sdrbase/settings/serializable.h index 89ffaaf2d..84d1420c8 100644 --- a/sdrbase/settings/serializable.h +++ b/sdrbase/settings/serializable.h @@ -18,12 +18,19 @@ #ifndef SDRBASE_SETTINGS_SERIALIZABLE_H_ #define SDRBASE_SETTINGS_SERIALIZABLE_H_ +namespace SWGSDRangel { + class SWGObject; +} + +class QStringList; class Serializable { public: virtual ~Serializable() {} - virtual QByteArray serialize() const = 0; - virtual bool deserialize(const QByteArray& data) = 0; + virtual QByteArray serialize() const = 0; //!< Serialize to inary + virtual bool deserialize(const QByteArray& data) = 0; //!< Deserialize from binary + virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const = 0; //!< Serialize to API + virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) = 0; //!< Deserialize from API }; #endif /* SDRBASE_SETTINGS_SERIALIZABLE_H_ */ diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 47439fdcf..7141d964b 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -1884,7 +1884,11 @@ void WebAPIRequestMapper::devicesetDeviceService(const std::string& indexStr, qt } } -void WebAPIRequestMapper::devicesetDeviceSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) +void WebAPIRequestMapper::devicesetDeviceSettingsService( + const std::string& indexStr, + qtwebapp::HttpRequest& request, + qtwebapp::HttpResponse& response +) { SWGSDRangel::SWGErrorResponse errorResponse; response.setHeader("Content-Type", "application/json"); @@ -4136,14 +4140,8 @@ bool WebAPIRequestMapper::getChannelSettings( if (channelKeys.contains(channelSettingsKey) && channelSettingsJson[channelSettingsKey].isObject()) { QJsonObject settingsJsonObject = channelSettingsJson[channelSettingsKey].toObject(); - channelSettingsKeys = settingsJsonObject.keys(); - - // get possible sub-keys - if (channelSettingsKeys.contains("cwKeyer")) - { - QJsonObject cwJson; // unused - appendSettingsSubKeys(settingsJsonObject, cwJson, "cwKeyer", channelSettingsKeys); - } + extractKeys(settingsJsonObject, channelSettingsKeys); + qDebug() << "WebAPIRequestMapper::getChannelSettings: channelSettingsKeys: " << channelSettingsKeys; if (channelSettingsKey == "ADSBDemodSettings") { @@ -4197,7 +4195,8 @@ bool WebAPIRequestMapper::getChannelSettings( } else if (channelSettingsKey == "ChannelAnalyzerSettings") { - processChannelAnalyzerSettings(channelSettings, settingsJsonObject, channelSettingsKeys); + channelSettings->setChannelAnalyzerSettings(new SWGSDRangel::SWGChannelAnalyzerSettings()); + processChannelAnalyzerSettings(channelSettings, settingsJsonObject); } else if (channelSettingsKey == "ChirpChatDemodSettings") { @@ -4473,7 +4472,12 @@ bool WebAPIRequestMapper::appendPresetDeviceKeys( { SWGSDRangel::SWGDeviceSettings *deviceSettings = new SWGSDRangel::SWGDeviceSettings(); device->setConfig(deviceSettings); - return getDeviceSettings(WebAPIUtils::m_deviceIdToSettingsKey[*deviceId], deviceSettings, deviceSettngsJson["config"].toObject(), devicelKeys.m_deviceKeys); + return getDeviceSettings( + WebAPIUtils::m_deviceIdToSettingsKey[*deviceId], + deviceSettings, + deviceSettngsJson["config"].toObject(), + devicelKeys.m_deviceKeys + ); } else { @@ -4498,7 +4502,8 @@ bool WebAPIRequestMapper::getDeviceSettings( if (deviceKeys.contains(deviceSettingsKey) && deviceSettingsJson[deviceSettingsKey].isObject()) { QJsonObject settingsJsonObject = deviceSettingsJson[deviceSettingsKey].toObject(); - deviceSettingsKeys = settingsJsonObject.keys(); + extractKeys(settingsJsonObject, deviceSettingsKeys); + qDebug() << "WebAPIRequestMapper::getDeviceSettings: deviceSettingsKeys: " << deviceSettingsKeys; if (deviceSettingsKey == "airspySettings") { @@ -4542,10 +4547,6 @@ bool WebAPIRequestMapper::getDeviceSettings( } else if (deviceSettingsKey == "bladeRF2MIMOSettings") { - if (deviceSettingsKeys.contains("streams") && settingsJsonObject["streams"].isArray()) { - appendSettingsArrayKeys(settingsJsonObject, "streams", deviceSettingsKeys); - } - deviceSettings->setBladeRf2MimoSettings(new SWGSDRangel::SWGBladeRF2MIMOSettings()); deviceSettings->getBladeRf2MimoSettings()->fromJsonObject(settingsJsonObject); } @@ -4596,19 +4597,11 @@ bool WebAPIRequestMapper::getDeviceSettings( } else if (deviceSettingsKey == "limeSdrMIMOSettings") { - if (deviceSettingsKeys.contains("streams") && settingsJsonObject["streams"].isArray()) { - appendSettingsArrayKeys(settingsJsonObject, "streams", deviceSettingsKeys); - } - deviceSettings->setLimeSdrMimoSettings(new SWGSDRangel::SWGLimeSdrMIMOSettings()); deviceSettings->getLimeSdrMimoSettings()->fromJsonObject(settingsJsonObject); } else if (deviceSettingsKey == "metisMISOSettings") { - if (deviceSettingsKeys.contains("streams") && settingsJsonObject["streams"].isArray()) { - appendSettingsArrayKeys(settingsJsonObject, "streams", deviceSettingsKeys); - } - deviceSettings->setMetisMisoSettings(new SWGSDRangel::SWGMetisMISOSettings()); deviceSettings->getMetisMisoSettings()->fromJsonObject(settingsJsonObject); } @@ -4668,20 +4661,12 @@ bool WebAPIRequestMapper::getDeviceSettings( } else if (deviceSettingsKey == "testMISettings") { - if (deviceSettingsKeys.contains("streams") && settingsJsonObject["streams"].isArray()) { - appendSettingsArrayKeys(settingsJsonObject, "streams", deviceSettingsKeys); - } - deviceSettings->setTestMiSettings(new SWGSDRangel::SWGTestMISettings()); deviceSettings->getTestMiSettings()->init(); deviceSettings->getTestMiSettings()->fromJsonObject(settingsJsonObject); } else if (deviceSettingsKey == "testMOSyncSettings") { - if (deviceSettingsKeys.contains("streams") && settingsJsonObject["streams"].isArray()) { - appendSettingsArrayKeys(settingsJsonObject, "streams", deviceSettingsKeys); - } - deviceSettings->setTestMoSyncSettings(new SWGSDRangel::SWGTestMOSyncSettings()); deviceSettings->getTestMoSyncSettings()->fromJsonObject(settingsJsonObject); } @@ -4707,10 +4692,6 @@ bool WebAPIRequestMapper::getDeviceSettings( } else if (deviceSettingsKey == "XtrxMIMOSettings") { - if (deviceSettingsKeys.contains("streams") && settingsJsonObject["streams"].isArray()) { - appendSettingsArrayKeys(settingsJsonObject, "streams", deviceSettingsKeys); - } - deviceSettings->setXtrxMimoSettings(new SWGSDRangel::SWGXtrxMIMOSettings()); deviceSettings->getXtrxMimoSettings()->fromJsonObject(settingsJsonObject); } @@ -4793,7 +4774,8 @@ bool WebAPIRequestMapper::getFeatureSettings( if (featureKeys.contains(featureSettingsKey) && featureSettingsJson[featureSettingsKey].isObject()) { QJsonObject settingsJsonObject = featureSettingsJson[featureSettingsKey].toObject(); - featureSettingsKeys = settingsJsonObject.keys(); + extractKeys(settingsJsonObject, featureSettingsKeys); + qDebug() << "WebAPIRequestMapper::getFeatureSettings: featureSettingsKeys: " << featureSettingsKeys; if (featureSettingsKey == "AISSSettings") { @@ -4810,6 +4792,11 @@ bool WebAPIRequestMapper::getFeatureSettings( featureSettings->setAprsSettings(new SWGSDRangel::SWGAPRSSettings()); featureSettings->getAprsSettings()->fromJsonObject(settingsJsonObject); } + else if (featureSettingsKey == "DemodAnalyzerSettings") + { + featureSettings->setDemodAnalyzerSettings(new SWGSDRangel::SWGDemodAnalyzerSettings()); + featureSettings->getDemodAnalyzerSettings()->fromJsonObject(settingsJsonObject); + } else if (featureSettingsKey == "GS232ControllerSettings") { featureSettings->setGs232ControllerSettings(new SWGSDRangel::SWGGS232ControllerSettings()); @@ -4933,39 +4920,39 @@ bool WebAPIRequestMapper::getFeatureActions( } } -void WebAPIRequestMapper::appendSettingsSubKeys( - const QJsonObject& parentSettingsJsonObject, - QJsonObject& childSettingsJsonObject, - const QString& parentKey, - QStringList& keyList) +void WebAPIRequestMapper::extractKeys( + const QJsonObject& rootJsonObject, + QStringList& keyList +) { - childSettingsJsonObject = parentSettingsJsonObject[parentKey].toObject(); - QStringList childSettingsKeys = childSettingsJsonObject.keys(); + QStringList rootKeys = rootJsonObject.keys(); - for (int i = 0; i < childSettingsKeys.size(); i++) { - keyList.append(parentKey + QString(".") + childSettingsKeys.at(i)); - } -} - -void WebAPIRequestMapper::appendSettingsArrayKeys( - const QJsonObject& parentSettingsJsonObject, - const QString& parentKey, - QStringList& keyList) -{ - QJsonArray arrayJson = parentSettingsJsonObject[parentKey].toArray(); - - for (int arrayIndex = 0; arrayIndex < arrayJson.count(); arrayIndex++) + for (auto rootKey : rootKeys) { - QJsonValue v = arrayJson.at(arrayIndex); + keyList.append(rootKey); - if (v.isObject()) + if (rootJsonObject[rootKey].isObject()) { - QJsonObject itemSettingsJsonObject = v.toObject(); - QStringList itemSettingsKeys = itemSettingsJsonObject.keys(); - keyList.append(tr("%1[%2]").arg(parentKey).arg(arrayIndex)); + QStringList subKeys; + extractKeys(rootJsonObject[rootKey].toObject(), subKeys); - for (int i = 0; i < itemSettingsKeys.size(); i++) { - keyList.append(tr("%1[%2].%3").arg(parentKey).arg(arrayIndex).arg(itemSettingsKeys[i])); + for (auto subKey : subKeys) { + keyList.append(tr("%1.%2").arg(rootKey).arg(subKey)); + } + } + else if (rootJsonObject[rootKey].isArray()) + { + QJsonArray arrayJson = rootJsonObject[rootKey].toArray(); + + for (int arrayIndex = 0; arrayIndex < arrayJson.count(); arrayIndex++) + { + QStringList subKeys; + extractKeys(arrayJson.at(arrayIndex).toObject(), subKeys); + keyList.append(tr("%1[%2]").arg(rootKey).arg(arrayIndex)); + + for (auto subKey : subKeys) { + keyList.append(tr("%1[%2].%3").arg(rootKey).arg(arrayIndex).arg(subKey)); + } } } } @@ -5155,8 +5142,7 @@ void WebAPIRequestMapper::resetFeatureActions(SWGSDRangel::SWGFeatureActions& fe void WebAPIRequestMapper::processChannelAnalyzerSettings( SWGSDRangel::SWGChannelSettings *channelSettings, - const QJsonObject& channelSettingsJson, - QStringList& channelSettingsKeys + const QJsonObject& channelSettingsJson ) { SWGSDRangel::SWGChannelAnalyzerSettings *channelAnalyzerSettings = new SWGSDRangel::SWGChannelAnalyzerSettings(); @@ -5215,7 +5201,6 @@ void WebAPIRequestMapper::processChannelAnalyzerSettings( spectrum->init(); channelAnalyzerSettings->setSpectrumConfig(spectrum); QJsonObject spectrumJson; - appendSettingsSubKeys(channelSettingsJson, spectrumJson, "spectrumConfig", channelSettingsKeys); spectrum->fromJsonObject(spectrumJson); } @@ -5225,7 +5210,6 @@ void WebAPIRequestMapper::processChannelAnalyzerSettings( scopeConfig->init(); channelAnalyzerSettings->setScopeConfig(scopeConfig); QJsonObject scopeConfigJson; - appendSettingsSubKeys(channelSettingsJson, scopeConfigJson, "scopeConfig", channelSettingsKeys); scopeConfig->fromJsonObject(scopeConfigJson); if (scopeConfigJson.contains("tracesData") && scopeConfigJson["tracesData"].isArray()) @@ -5241,13 +5225,6 @@ void WebAPIRequestMapper::processChannelAnalyzerSettings( QJsonObject traceJson = tracesJson.at(i).toObject(); traceData->fromJsonObject(traceJson); } - - QStringList tracesDataKeys; - appendSettingsArrayKeys(scopeConfigJson, "tracesData", tracesDataKeys); - - for (int i = 0; i < tracesDataKeys.size(); i++) { - channelSettingsKeys.append(QString("scopeConfig.") + tracesDataKeys.at(i)); - } } if (scopeConfigJson.contains("triggersData") && scopeConfigJson["triggersData"].isArray()) @@ -5263,13 +5240,6 @@ void WebAPIRequestMapper::processChannelAnalyzerSettings( QJsonObject triggerJson = triggersJson.at(i).toObject(); triggerData->fromJsonObject(triggerJson); } - - QStringList triggersDataKeys; - appendSettingsArrayKeys(scopeConfigJson, "triggersData", triggersDataKeys); - - for (int i = 0; i < triggersDataKeys.size(); i++) { - channelSettingsKeys.append(QString("scopeConfig.") + triggersDataKeys.at(i)); - } } } } @@ -5471,8 +5441,6 @@ void WebAPIRequestMapper::processSoapySDRSettings( QJsonObject argValueJson = argsJson.at(i).toObject(); argValue->fromJsonObject(argValueJson); } - - appendSettingsArrayKeys(deviceSettingsJson, "deviceArgSettings", deviceSettingsKeys); } if (deviceSettingsKeys.contains("individualGains")) @@ -5493,8 +5461,6 @@ void WebAPIRequestMapper::processSoapySDRSettings( QJsonObject argValueJson = argsJson.at(i).toObject(); argValue->fromJsonObject(argValueJson); } - - appendSettingsArrayKeys(deviceSettingsJson, "individualGains", deviceSettingsKeys); } if (deviceSettingsKeys.contains("streamArgSettings")) @@ -5515,8 +5481,6 @@ void WebAPIRequestMapper::processSoapySDRSettings( QJsonObject argValueJson = argsJson.at(i).toObject(); argValue->fromJsonObject(argValueJson); } - - appendSettingsArrayKeys(deviceSettingsJson, "streamArgSettings", deviceSettingsKeys); } if (deviceSettingsKeys.contains("tunableElements")) @@ -5537,7 +5501,5 @@ void WebAPIRequestMapper::processSoapySDRSettings( QJsonObject argValueJson = argsJson.at(i).toObject(); argValue->fromJsonObject(argValueJson); } - - appendSettingsArrayKeys(deviceSettingsJson, "tunableElements", deviceSettingsKeys); } } diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index e75bf39d0..03c527fc2 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -185,16 +185,10 @@ private: QStringList& deviceActionsKeys ); - void appendSettingsSubKeys( - const QJsonObject& parentSettingsJsonObject, - QJsonObject& childSettingsJsonObject, - const QString& parentKey, - QStringList& keyList); - - void appendSettingsArrayKeys( - const QJsonObject& parentSettingsJsonObject, - const QString& parentKey, - QStringList& keyList); + void extractKeys( + const QJsonObject& rootJsonObject, + QStringList& keyList + ); bool getFeatureSettings( const QString& featureSettingsKey, @@ -227,8 +221,7 @@ private: void processChannelAnalyzerSettings( SWGSDRangel::SWGChannelSettings *channelSettings, - const QJsonObject& channelSettingsJson, - QStringList& channelSettingsKeys + const QJsonObject& channelSettingsJson ); void processSoapySDRSettings( diff --git a/sdrbase/webapi/webapiutils.cpp b/sdrbase/webapi/webapiutils.cpp index 323d03c37..bca630f72 100644 --- a/sdrbase/webapi/webapiutils.cpp +++ b/sdrbase/webapi/webapiutils.cpp @@ -267,6 +267,7 @@ const QMap WebAPIUtils::m_featureTypeToSettingsKey = { {"AIS", "AISSettings"}, {"AntennaTools", "AntennaToolsSettings"}, {"APRS", "APRSSettings"}, + {"DemodAnalyzer", "DemodAnalyzerSettings"}, {"GS232Controller", "GS232ControllerSettings"}, {"Map", "MapSettings"}, {"PERTester", "PERTesterSettings"}, @@ -292,6 +293,7 @@ const QMap WebAPIUtils::m_featureURIToSettingsKey = { {"sdrangel.feature.ais", "AISSSettings"}, {"sdrangel.feature.antennatools", "AntennaToolsSettings"}, {"sdrangel.feature.aprs", "APRSSettings"}, + {"sdrangel.feature.demodanalyzer", "DemodAnalyzerSettings"}, {"sdrangel.feature.gs232controller", "GS232ControllerSettings"}, {"sdrangel.feature.map", "MapSettings"}, {"sdrangel.feature.pertester", "PERTesterSettings"}, diff --git a/sdrgui/gui/cwkeyergui.cpp b/sdrgui/gui/cwkeyergui.cpp index 1eb60bef1..ad91dfb1f 100644 --- a/sdrgui/gui/cwkeyergui.cpp +++ b/sdrgui/gui/cwkeyergui.cpp @@ -81,6 +81,16 @@ bool CWKeyerGUI::deserialize(const QByteArray& data) } } +void CWKeyerGUI::formatTo(SWGSDRangel::SWGObject *swgObject) const +{ + m_settings.formatTo(swgObject); +} + +void CWKeyerGUI::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) +{ + m_settings.updateFrom(keys, swgObject); +} + // === SLOTS ================================================================== void CWKeyerGUI::on_cwTextClear_clicked(bool checked) diff --git a/sdrgui/gui/cwkeyergui.h b/sdrgui/gui/cwkeyergui.h index 5167751fd..786d854c7 100644 --- a/sdrgui/gui/cwkeyergui.h +++ b/sdrgui/gui/cwkeyergui.h @@ -47,6 +47,8 @@ public: void resetToDefaults(); QByteArray serialize() const; bool deserialize(const QByteArray& data); + virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const; + virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject); void setSettings(const CWKeyerSettings& settings) { m_settings = settings; } void displaySettings(); diff --git a/sdrgui/gui/glscopegui.cpp b/sdrgui/gui/glscopegui.cpp index 80c18ec38..9f8c5524c 100644 --- a/sdrgui/gui/glscopegui.cpp +++ b/sdrgui/gui/glscopegui.cpp @@ -35,7 +35,6 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) : m_sampleRate(0), m_timeBase(1), m_timeOffset(0), - m_traceLenMult(1), m_ctlTraceIndex(0), m_ctlTriggerIndex(0) { @@ -105,7 +104,7 @@ void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLSc fillProjectionCombo(ui->trigMode); m_scopeVis->configure( - 2*m_traceLenMult*m_scopeVis->getTraceChunkSize(), + 2*m_settings.m_traceLenMult*m_scopeVis->getTraceChunkSize(), m_timeBase, m_timeOffset*10, (uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)), @@ -113,7 +112,7 @@ void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLSc ); m_scopeVis->configure( - m_traceLenMult*m_scopeVis->getTraceChunkSize(), + m_settings.m_traceLenMult*m_scopeVis->getTraceChunkSize(), m_timeBase, m_timeOffset*10, (uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)), @@ -149,8 +148,8 @@ void GLScopeGUI::onScopeSampleRateChanged(int sampleRate) void GLScopeGUI::onScopeTraceSizeChanged(uint32_t traceNbSamples) { qDebug("GLScopeGUI::onScopeTraceSizeChanged: %u", traceNbSamples); - m_traceLenMult = traceNbSamples / m_scopeVis->getTraceChunkSize(); - ui->traceLen->setValue(m_traceLenMult); + m_settings.m_traceLenMult = traceNbSamples / m_scopeVis->getTraceChunkSize(); + ui->traceLen->setValue(m_settings.m_traceLenMult); setTraceLenDisplay(); } @@ -263,6 +262,22 @@ bool GLScopeGUI::deserialize(const QByteArray& data) return ret; } +void GLScopeGUI::formatTo(SWGSDRangel::SWGObject *swgObject) const +{ + m_settings.formatTo(swgObject); +} + +void GLScopeGUI::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) +{ + m_settings.updateFrom(keys, swgObject); +} + +void GLScopeGUI::updateSettings() +{ + displaySettings(); + applySettings(m_settings); /// FIXME +} + void GLScopeGUI::setNbStreams(unsigned int nbStreams) { QStringList streamNames; @@ -464,7 +479,7 @@ void GLScopeGUI::on_time_valueChanged(int value) setTimeScaleDisplay(); setTraceDelayDisplay(); m_scopeVis->configure( - m_traceLenMult*m_scopeVis->getTraceChunkSize(), + m_settings.m_traceLenMult*m_scopeVis->getTraceChunkSize(), m_timeBase, m_timeOffset*10, (uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)), @@ -482,7 +497,7 @@ void GLScopeGUI::on_timeOfs_valueChanged(int value) m_settings.m_timeOfs = value; setTimeOfsDisplay(); m_scopeVis->configure( - m_traceLenMult*m_scopeVis->getTraceChunkSize(), + m_settings.m_traceLenMult*m_scopeVis->getTraceChunkSize(), m_timeBase, m_timeOffset*10, (uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)), @@ -502,10 +517,9 @@ void GLScopeGUI::on_traceLen_valueChanged(int value) return; } - m_traceLenMult = value; - m_settings.m_traceLen = m_traceLenMult*m_scopeVis->getTraceChunkSize(); + m_settings.m_traceLenMult = value; m_scopeVis->configure( - m_traceLenMult*m_scopeVis->getTraceChunkSize(), + m_settings.m_traceLenMult*m_scopeVis->getTraceChunkSize(), m_timeBase, m_timeOffset*10, (uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)), @@ -945,7 +959,7 @@ void GLScopeGUI::on_trigPre_valueChanged(int value) (void) value; setTrigPreDisplay(); m_scopeVis->configure( - m_traceLenMult*m_scopeVis->getTraceChunkSize(), + m_settings.m_traceLenMult*m_scopeVis->getTraceChunkSize(), m_timeBase, m_timeOffset*10, (uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)), @@ -986,7 +1000,7 @@ void GLScopeGUI::on_freerun_toggled(bool checked) } m_scopeVis->configure( - m_traceLenMult*m_scopeVis->getTraceChunkSize(), + m_settings.m_traceLenMult*m_scopeVis->getTraceChunkSize(), m_timeBase, m_timeOffset*10, (uint32_t) (m_glScope->getTraceSize() * (ui->trigPre->value()/100.0f)), @@ -1043,7 +1057,7 @@ void GLScopeGUI::setTimeScaleDisplay() void GLScopeGUI::setTraceLenDisplay() { - unsigned int n_samples = m_traceLenMult * m_scopeVis->getTraceChunkSize(); + unsigned int n_samples = m_settings.m_traceLenMult * m_scopeVis->getTraceChunkSize(); if (n_samples < 1000) { ui->traceLenText->setToolTip(tr("%1 S").arg(n_samples)); @@ -1209,7 +1223,7 @@ void GLScopeGUI::setTrigDelayDisplay() if (m_sampleRate > 0) { double delayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / (m_scopeVis->getTraceChunkSize() / 10.0); - unsigned int n_samples_delay = m_traceLenMult * m_scopeVis->getTraceChunkSize() * delayMult; + unsigned int n_samples_delay = m_settings.m_traceLenMult * m_scopeVis->getTraceChunkSize() * delayMult; if (n_samples_delay < 1000) { ui->trigDelayText->setToolTip(tr("%1 S").arg(n_samples_delay)); @@ -1361,7 +1375,7 @@ void GLScopeGUI::fillTriggerData(GLScopeSettings::TriggerData& triggerData) triggerData.m_triggerHoldoff = ui->trigHoldoff->value(); triggerData.m_triggerRepeat = ui->trigCount->value(); triggerData.m_triggerDelayMult = ui->trigDelayCoarse->value() + ui->trigDelayFine->value() / (m_scopeVis->getTraceChunkSize() / 10.0); - triggerData.m_triggerDelay = (int) (m_traceLenMult * m_scopeVis->getTraceChunkSize() * triggerData.m_triggerDelayMult); + triggerData.m_triggerDelay = (int) (m_settings.m_traceLenMult * m_scopeVis->getTraceChunkSize() * triggerData.m_triggerDelayMult); triggerData.m_triggerDelayCoarse = ui->trigDelayCoarse->value(); triggerData.m_triggerDelayFine = ui->trigDelayFine->value(); triggerData.setColor(m_focusedTriggerColor); @@ -1490,7 +1504,7 @@ void GLScopeGUI::displaySettings() setTimeScaleDisplay(); ui->timeOfs->setValue(m_settings.m_timeOfs); setTimeOfsDisplay(); - ui->traceLen->setValue(m_traceLenMult); + ui->traceLen->setValue(m_settings.m_traceLenMult); } bool GLScopeGUI::handleMessage(Message* message) @@ -1777,7 +1791,7 @@ void GLScopeGUI::focusOnTrigger(int triggerIndex) void GLScopeGUI::traceLengthChange() { - on_traceLen_valueChanged(m_traceLenMult); + on_traceLen_valueChanged(m_settings.m_traceLenMult); } void GLScopeGUI::settingsTraceAdd(const GLScopeSettings::TraceData& traceData) diff --git a/sdrgui/gui/glscopegui.h b/sdrgui/gui/glscopegui.h index ddb4ffe62..b225baa24 100644 --- a/sdrgui/gui/glscopegui.h +++ b/sdrgui/gui/glscopegui.h @@ -49,6 +49,9 @@ public: void resetToDefaults(); virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const; + virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject); + void updateSettings(); bool handleMessage(Message* message); unsigned int getNbTraces() const { return m_settings.m_tracesData.size(); } @@ -155,7 +158,6 @@ private: int m_sampleRate; int m_timeBase; int m_timeOffset; - int m_traceLenMult; QColor m_focusedTraceColor; QColor m_focusedTriggerColor; int m_ctlTraceIndex; //!< controlled trace index diff --git a/sdrgui/gui/glspectrumgui.cpp b/sdrgui/gui/glspectrumgui.cpp index 19b30ebb7..11302d7dd 100644 --- a/sdrgui/gui/glspectrumgui.cpp +++ b/sdrgui/gui/glspectrumgui.cpp @@ -115,6 +115,22 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data) } } +void GLSpectrumGUI::formatTo(SWGSDRangel::SWGObject *swgObject) const +{ + m_settings.formatTo(swgObject); +} + +void GLSpectrumGUI::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject) +{ + m_settings.updateFrom(keys, swgObject); +} + +void GLSpectrumGUI::updateSettings() +{ + displaySettings(); + applySettings(); +} + void GLSpectrumGUI::displaySettings() { blockApplySettings(true); diff --git a/sdrgui/gui/glspectrumgui.h b/sdrgui/gui/glspectrumgui.h index b90798ebc..e5ba84b85 100644 --- a/sdrgui/gui/glspectrumgui.h +++ b/sdrgui/gui/glspectrumgui.h @@ -58,6 +58,9 @@ public: void resetToDefaults(); virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const; + virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject); + void updateSettings(); private: Ui::GLSpectrumGUI* ui; diff --git a/swagger/sdrangel/api/swagger/include/BFMDemod.yaml b/swagger/sdrangel/api/swagger/include/BFMDemod.yaml index 8fc44c981..a9fdc7707 100644 --- a/swagger/sdrangel/api/swagger/include/BFMDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/BFMDemod.yaml @@ -44,6 +44,8 @@ BFMDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" BFMDemodReport: description: BFMDemod diff --git a/swagger/sdrangel/api/swagger/include/ChannelAnalyzer.yaml b/swagger/sdrangel/api/swagger/include/ChannelAnalyzer.yaml index 02ae5b61e..a420bdd03 100644 --- a/swagger/sdrangel/api/swagger/include/ChannelAnalyzer.yaml +++ b/swagger/sdrangel/api/swagger/include/ChannelAnalyzer.yaml @@ -54,3 +54,5 @@ ChannelAnalyzerSettings: $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" scopeConfig: $ref: "http://swgserver:8081/api/swagger/include/GLScope.yaml#/GLScope" + channelMarker: + $ref: "http://swgserver:8081/api/swagger/include/ChannelMarker.yaml#/ChannelMarker" diff --git a/swagger/sdrangel/api/swagger/include/ChannelMarker.yaml b/swagger/sdrangel/api/swagger/include/ChannelMarker.yaml new file mode 100644 index 000000000..328397aaf --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/ChannelMarker.yaml @@ -0,0 +1,13 @@ +ChannelMarker: + description: ChannelMarker settings + properties: + centerFrequency: + type: integer + color: + type: integer + description: RGB color + title: + type: string + frequencyScaleDisplayType: + type: integer + description: ChannelMarker::frequencyScaleDisplay_t diff --git a/swagger/sdrangel/api/swagger/include/ChirpChatDemod.yaml b/swagger/sdrangel/api/swagger/include/ChirpChatDemod.yaml index 278108bb3..bf2829ff4 100644 --- a/swagger/sdrangel/api/swagger/include/ChirpChatDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/ChirpChatDemod.yaml @@ -118,6 +118,8 @@ ChirpChatDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" ChirpChatDemodReport: description: ChirpChatDemod diff --git a/swagger/sdrangel/api/swagger/include/FileSink.yaml b/swagger/sdrangel/api/swagger/include/FileSink.yaml index 1f8f1423e..d154b3564 100644 --- a/swagger/sdrangel/api/swagger/include/FileSink.yaml +++ b/swagger/sdrangel/api/swagger/include/FileSink.yaml @@ -48,6 +48,8 @@ FileSinkSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" FileSinkReport: description: FileSink diff --git a/swagger/sdrangel/api/swagger/include/FreeDVDemod.yaml b/swagger/sdrangel/api/swagger/include/FreeDVDemod.yaml index 072085c1d..0dd230583 100644 --- a/swagger/sdrangel/api/swagger/include/FreeDVDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/FreeDVDemod.yaml @@ -42,6 +42,8 @@ FreeDVDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" FreeDVDemodReport: description: FreeDVDemod diff --git a/swagger/sdrangel/api/swagger/include/FreeDVMod.yaml b/swagger/sdrangel/api/swagger/include/FreeDVMod.yaml index cfa9e8259..6328e2a3a 100644 --- a/swagger/sdrangel/api/swagger/include/FreeDVMod.yaml +++ b/swagger/sdrangel/api/swagger/include/FreeDVMod.yaml @@ -44,6 +44,8 @@ FreeDVModSettings: type: integer cwKeyer: $ref: "http://swgserver:8081/api/swagger/include/CWKeyer.yaml#/CWKeyerSettings" + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" FreeDVModReport: description: FreeDVMod diff --git a/swagger/sdrangel/api/swagger/include/FreqTracker.yaml b/swagger/sdrangel/api/swagger/include/FreqTracker.yaml index 5d507b162..51309fab3 100644 --- a/swagger/sdrangel/api/swagger/include/FreqTracker.yaml +++ b/swagger/sdrangel/api/swagger/include/FreqTracker.yaml @@ -57,6 +57,8 @@ FreqTrackerSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" FreqTrackerReport: description: FreqTracker diff --git a/swagger/sdrangel/api/swagger/include/GLScope.yaml b/swagger/sdrangel/api/swagger/include/GLScope.yaml index b66f805b8..996e4da42 100644 --- a/swagger/sdrangel/api/swagger/include/GLScope.yaml +++ b/swagger/sdrangel/api/swagger/include/GLScope.yaml @@ -129,8 +129,9 @@ GLScope: type: integer timeOfs: type: integer - traceLen: + traceLenMult: type: integer + description: Trace length multiplier (multiplies 4800 samples) trigPre: type: integer tracesData: diff --git a/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml b/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml index f61a40efe..d931dc488 100644 --- a/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml +++ b/swagger/sdrangel/api/swagger/include/GLSpectrum.yaml @@ -62,6 +62,12 @@ GLSpectrum: usb: description: boolean type: integer + wsSpectrum: + type: integer + description: > + Boolean - Start or stop websocket server + * 0 - Stop server + * 1 - Start server wsSpectrumAddress: description: IPv4 address of interface the websocket server is listening to type: string diff --git a/swagger/sdrangel/api/swagger/include/SSBDemod.yaml b/swagger/sdrangel/api/swagger/include/SSBDemod.yaml index 1879d5e96..4f6712e8e 100644 --- a/swagger/sdrangel/api/swagger/include/SSBDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/SSBDemod.yaml @@ -62,6 +62,8 @@ SSBDemodSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" SSBDemodReport: description: SSBDemod diff --git a/swagger/sdrangel/api/swagger/include/SSBMod.yaml b/swagger/sdrangel/api/swagger/include/SSBMod.yaml index bb07fc91b..1a639b357 100644 --- a/swagger/sdrangel/api/swagger/include/SSBMod.yaml +++ b/swagger/sdrangel/api/swagger/include/SSBMod.yaml @@ -60,6 +60,8 @@ SSBModSettings: type: integer cwKeyer: $ref: "http://swgserver:8081/api/swagger/include/CWKeyer.yaml#/CWKeyerSettings" + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" SSBModReport: description: SSBMod diff --git a/swagger/sdrangel/api/swagger/include/SigMFFileSink.yaml b/swagger/sdrangel/api/swagger/include/SigMFFileSink.yaml index e64f0e0cc..6d8a822a4 100644 --- a/swagger/sdrangel/api/swagger/include/SigMFFileSink.yaml +++ b/swagger/sdrangel/api/swagger/include/SigMFFileSink.yaml @@ -48,6 +48,8 @@ SigMFFileSinkSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" SigMFFileSinkReport: description: SigMFFileSink diff --git a/swagger/sdrangel/api/swagger/include/UDPSink.yaml b/swagger/sdrangel/api/swagger/include/UDPSink.yaml index 1e7800d15..2b2b2d245 100644 --- a/swagger/sdrangel/api/swagger/include/UDPSink.yaml +++ b/swagger/sdrangel/api/swagger/include/UDPSink.yaml @@ -69,6 +69,8 @@ UDPSinkSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" UDPSinkReport: description: UDPSink diff --git a/swagger/sdrangel/api/swagger/include/UDPSource.yaml b/swagger/sdrangel/api/swagger/include/UDPSource.yaml index 641de4ddc..a0cbc2dda 100644 --- a/swagger/sdrangel/api/swagger/include/UDPSource.yaml +++ b/swagger/sdrangel/api/swagger/include/UDPSource.yaml @@ -71,6 +71,8 @@ UDPSourceSettings: type: integer reverseAPIChannelIndex: type: integer + spectrumConfig: + $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum" UDPSourceReport: description: UDPSource diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 5ac129b21..d536feb69 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -2325,6 +2325,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "BFMDemod" @@ -3003,6 +3006,9 @@ margin-bottom: 20px; }, "scopeConfig" : { "$ref" : "#/definitions/GLScope" + }, + "channelMarker" : { + "$ref" : "#/definitions/ChannelMarker" } }, "description" : "ChannelAnalyzer" @@ -3048,6 +3054,25 @@ margin-bottom: 20px; } }, "description" : "Summarized information about channel plugin" +}; + defs.ChannelMarker = { + "properties" : { + "centerFrequency" : { + "type" : "integer" + }, + "color" : { + "type" : "integer", + "description" : "RGB color" + }, + "title" : { + "type" : "string" + }, + "frequencyScaleDisplayType" : { + "type" : "integer", + "description" : "ChannelMarker::frequencyScaleDisplay_t" + } + }, + "description" : "ChannelMarker settings" }; defs.ChannelReport = { "required" : [ "direction" ], @@ -3536,6 +3561,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "ChirpChatDemod" @@ -5395,6 +5423,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FileSink" @@ -5575,6 +5606,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FreeDVDemod" @@ -5658,6 +5692,9 @@ margin-bottom: 20px; }, "cwKeyer" : { "$ref" : "#/definitions/CWKeyerSettings" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FreeDVMod" @@ -5763,6 +5800,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "FreqTracker" @@ -5827,8 +5867,9 @@ margin-bottom: 20px; "timeOfs" : { "type" : "integer" }, - "traceLen" : { - "type" : "integer" + "traceLenMult" : { + "type" : "integer", + "description" : "Trace length multiplier (multiplies 4800 samples)" }, "trigPre" : { "type" : "integer" @@ -5934,6 +5975,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "boolean" }, + "wsSpectrum" : { + "type" : "integer", + "description" : "Boolean - Start or stop websocket server\n * 0 - Stop server\n * 1 - Start server\n" + }, "wsSpectrumAddress" : { "type" : "string", "description" : "IPv4 address of interface the websocket server is listening to" @@ -10304,6 +10349,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "SSBDemod" @@ -10410,6 +10458,9 @@ margin-bottom: 20px; }, "cwKeyer" : { "$ref" : "#/definitions/CWKeyerSettings" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "SSBMod" @@ -10954,6 +11005,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "SigMFFileSink" @@ -12201,6 +12255,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "UDPSink" @@ -12326,6 +12383,9 @@ margin-bottom: 20px; }, "reverseAPIChannelIndex" : { "type" : "integer" + }, + "spectrumConfig" : { + "$ref" : "#/definitions/GLSpectrum" } }, "description" : "UDPSource" @@ -51387,7 +51447,7 @@ except ApiException as e:
- Generated 2021-11-24T06:35:35.789+01:00 + Generated 2021-11-30T22:42:47.179+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp index d91f1ae6d..71d0a28cf 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp @@ -64,6 +64,8 @@ SWGBFMDemodSettings::SWGBFMDemodSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGBFMDemodSettings::~SWGBFMDemodSettings() { @@ -108,6 +110,8 @@ SWGBFMDemodSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -136,6 +140,9 @@ SWGBFMDemodSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGBFMDemodSettings* @@ -185,6 +192,8 @@ SWGBFMDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -255,6 +264,9 @@ SWGBFMDemodSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -439,6 +451,16 @@ SWGBFMDemodSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGBFMDemodSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGBFMDemodSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGBFMDemodSettings::isSet(){ @@ -498,6 +520,9 @@ SWGBFMDemodSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h index 95d4b5b19..1b754baee 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -96,6 +97,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -154,6 +158,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.cpp index cda2e09ed..5d97042cf 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.cpp @@ -70,6 +70,8 @@ SWGChannelAnalyzerSettings::SWGChannelAnalyzerSettings() { m_spectrum_config_isSet = false; scope_config = nullptr; m_scope_config_isSet = false; + channel_marker = nullptr; + m_channel_marker_isSet = false; } SWGChannelAnalyzerSettings::~SWGChannelAnalyzerSettings() { @@ -120,6 +122,8 @@ SWGChannelAnalyzerSettings::init() { m_spectrum_config_isSet = false; scope_config = new SWGGLScope(); m_scope_config_isSet = false; + channel_marker = new SWGChannelMarker(); + m_channel_marker_isSet = false; } void @@ -151,6 +155,9 @@ SWGChannelAnalyzerSettings::cleanup() { if(scope_config != nullptr) { delete scope_config; } + if(channel_marker != nullptr) { + delete channel_marker; + } } SWGChannelAnalyzerSettings* @@ -206,6 +213,8 @@ SWGChannelAnalyzerSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&scope_config, pJson["scopeConfig"], "SWGGLScope", "SWGGLScope"); + ::SWGSDRangel::setValue(&channel_marker, pJson["channelMarker"], "SWGChannelMarker", "SWGChannelMarker"); + } QString @@ -285,6 +294,9 @@ SWGChannelAnalyzerSettings::asJsonObject() { if((scope_config != nullptr) && (scope_config->isSet())){ toJsonValue(QString("scopeConfig"), scope_config, obj, QString("SWGGLScope")); } + if((channel_marker != nullptr) && (channel_marker->isSet())){ + toJsonValue(QString("channelMarker"), channel_marker, obj, QString("SWGChannelMarker")); + } return obj; } @@ -499,6 +511,16 @@ SWGChannelAnalyzerSettings::setScopeConfig(SWGGLScope* scope_config) { this->m_scope_config_isSet = true; } +SWGChannelMarker* +SWGChannelAnalyzerSettings::getChannelMarker() { + return channel_marker; +} +void +SWGChannelAnalyzerSettings::setChannelMarker(SWGChannelMarker* channel_marker) { + this->channel_marker = channel_marker; + this->m_channel_marker_isSet = true; +} + bool SWGChannelAnalyzerSettings::isSet(){ @@ -567,6 +589,9 @@ SWGChannelAnalyzerSettings::isSet(){ if(scope_config && scope_config->isSet()){ isObjectUpdated = true; break; } + if(channel_marker && channel_marker->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.h b/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.h index 557c0ba77..c4a33e3a2 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGChannelAnalyzerSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGChannelMarker.h" #include "SWGGLScope.h" #include "SWGGLSpectrum.h" #include @@ -107,6 +108,9 @@ public: SWGGLScope* getScopeConfig(); void setScopeConfig(SWGGLScope* scope_config); + SWGChannelMarker* getChannelMarker(); + void setChannelMarker(SWGChannelMarker* channel_marker); + virtual bool isSet() override; @@ -174,6 +178,9 @@ private: SWGGLScope* scope_config; bool m_scope_config_isSet; + SWGChannelMarker* channel_marker; + bool m_channel_marker_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelMarker.cpp b/swagger/sdrangel/code/qt5/client/SWGChannelMarker.cpp new file mode 100644 index 000000000..726beca35 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGChannelMarker.cpp @@ -0,0 +1,179 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 6.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGChannelMarker.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGChannelMarker::SWGChannelMarker(QString* json) { + init(); + this->fromJson(*json); +} + +SWGChannelMarker::SWGChannelMarker() { + center_frequency = 0; + m_center_frequency_isSet = false; + color = 0; + m_color_isSet = false; + title = nullptr; + m_title_isSet = false; + frequency_scale_display_type = 0; + m_frequency_scale_display_type_isSet = false; +} + +SWGChannelMarker::~SWGChannelMarker() { + this->cleanup(); +} + +void +SWGChannelMarker::init() { + center_frequency = 0; + m_center_frequency_isSet = false; + color = 0; + m_color_isSet = false; + title = new QString(""); + m_title_isSet = false; + frequency_scale_display_type = 0; + m_frequency_scale_display_type_isSet = false; +} + +void +SWGChannelMarker::cleanup() { + + + if(title != nullptr) { + delete title; + } + +} + +SWGChannelMarker* +SWGChannelMarker::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGChannelMarker::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint32", ""); + + ::SWGSDRangel::setValue(&color, pJson["color"], "qint32", ""); + + ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); + + ::SWGSDRangel::setValue(&frequency_scale_display_type, pJson["frequencyScaleDisplayType"], "qint32", ""); + +} + +QString +SWGChannelMarker::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGChannelMarker::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_center_frequency_isSet){ + obj->insert("centerFrequency", QJsonValue(center_frequency)); + } + if(m_color_isSet){ + obj->insert("color", QJsonValue(color)); + } + if(title != nullptr && *title != QString("")){ + toJsonValue(QString("title"), title, obj, QString("QString")); + } + if(m_frequency_scale_display_type_isSet){ + obj->insert("frequencyScaleDisplayType", QJsonValue(frequency_scale_display_type)); + } + + return obj; +} + +qint32 +SWGChannelMarker::getCenterFrequency() { + return center_frequency; +} +void +SWGChannelMarker::setCenterFrequency(qint32 center_frequency) { + this->center_frequency = center_frequency; + this->m_center_frequency_isSet = true; +} + +qint32 +SWGChannelMarker::getColor() { + return color; +} +void +SWGChannelMarker::setColor(qint32 color) { + this->color = color; + this->m_color_isSet = true; +} + +QString* +SWGChannelMarker::getTitle() { + return title; +} +void +SWGChannelMarker::setTitle(QString* title) { + this->title = title; + this->m_title_isSet = true; +} + +qint32 +SWGChannelMarker::getFrequencyScaleDisplayType() { + return frequency_scale_display_type; +} +void +SWGChannelMarker::setFrequencyScaleDisplayType(qint32 frequency_scale_display_type) { + this->frequency_scale_display_type = frequency_scale_display_type; + this->m_frequency_scale_display_type_isSet = true; +} + + +bool +SWGChannelMarker::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_center_frequency_isSet){ + isObjectUpdated = true; break; + } + if(m_color_isSet){ + isObjectUpdated = true; break; + } + if(title && *title != QString("")){ + isObjectUpdated = true; break; + } + if(m_frequency_scale_display_type_isSet){ + isObjectUpdated = true; break; + } + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelMarker.h b/swagger/sdrangel/code/qt5/client/SWGChannelMarker.h new file mode 100644 index 000000000..173e4719b --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGChannelMarker.h @@ -0,0 +1,77 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 6.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGChannelMarker.h + * + * ChannelMarker settings + */ + +#ifndef SWGChannelMarker_H_ +#define SWGChannelMarker_H_ + +#include + + +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGChannelMarker: public SWGObject { +public: + SWGChannelMarker(); + SWGChannelMarker(QString* json); + virtual ~SWGChannelMarker(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGChannelMarker* fromJson(QString &jsonString) override; + + qint32 getCenterFrequency(); + void setCenterFrequency(qint32 center_frequency); + + qint32 getColor(); + void setColor(qint32 color); + + QString* getTitle(); + void setTitle(QString* title); + + qint32 getFrequencyScaleDisplayType(); + void setFrequencyScaleDisplayType(qint32 frequency_scale_display_type); + + + virtual bool isSet() override; + +private: + qint32 center_frequency; + bool m_center_frequency_isSet; + + qint32 color; + bool m_color_isSet; + + QString* title; + bool m_title_isSet; + + qint32 frequency_scale_display_type; + bool m_frequency_scale_display_type_isSet; + +}; + +} + +#endif /* SWGChannelMarker_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.cpp index f3e56475b..55d566cdd 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.cpp @@ -82,6 +82,8 @@ SWGChirpChatDemodSettings::SWGChirpChatDemodSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGChirpChatDemodSettings::~SWGChirpChatDemodSettings() { @@ -144,6 +146,8 @@ SWGChirpChatDemodSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -181,6 +185,9 @@ SWGChirpChatDemodSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGChirpChatDemodSettings* @@ -248,6 +255,8 @@ SWGChirpChatDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -345,6 +354,9 @@ SWGChirpChatDemodSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -619,6 +631,16 @@ SWGChirpChatDemodSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_ this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGChirpChatDemodSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGChirpChatDemodSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGChirpChatDemodSettings::isSet(){ @@ -705,6 +727,9 @@ SWGChirpChatDemodSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.h index 1268a376a..728d61640 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGChirpChatDemodSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -123,6 +124,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -208,6 +212,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.cpp index 2d86b1e2b..780d65d2c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.cpp @@ -60,6 +60,8 @@ SWGFileSinkSettings::SWGFileSinkSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGFileSinkSettings::~SWGFileSinkSettings() { @@ -100,6 +102,8 @@ SWGFileSinkSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -126,6 +130,9 @@ SWGFileSinkSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGFileSinkSettings* @@ -171,6 +178,8 @@ SWGFileSinkSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -235,6 +244,9 @@ SWGFileSinkSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -399,6 +411,16 @@ SWGFileSinkSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGFileSinkSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGFileSinkSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGFileSinkSettings::isSet(){ @@ -452,6 +474,9 @@ SWGFileSinkSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.h b/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.h index 7d7b40f0f..320c5c6cd 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGFileSinkSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -90,6 +91,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -142,6 +146,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.cpp index 622441a4f..e424ea34a 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.cpp @@ -60,6 +60,8 @@ SWGFreeDVDemodSettings::SWGFreeDVDemodSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGFreeDVDemodSettings::~SWGFreeDVDemodSettings() { @@ -100,6 +102,8 @@ SWGFreeDVDemodSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -126,6 +130,9 @@ SWGFreeDVDemodSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGFreeDVDemodSettings* @@ -171,6 +178,8 @@ SWGFreeDVDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -235,6 +244,9 @@ SWGFreeDVDemodSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -399,6 +411,16 @@ SWGFreeDVDemodSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_ind this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGFreeDVDemodSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGFreeDVDemodSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGFreeDVDemodSettings::isSet(){ @@ -452,6 +474,9 @@ SWGFreeDVDemodSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.h index 020bff763..4cc829b46 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGFreeDVDemodSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -90,6 +91,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -142,6 +146,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.cpp index 4ca18e52e..3422c5227 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.cpp @@ -66,6 +66,8 @@ SWGFreeDVModSettings::SWGFreeDVModSettings() { m_reverse_api_channel_index_isSet = false; cw_keyer = nullptr; m_cw_keyer_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGFreeDVModSettings::~SWGFreeDVModSettings() { @@ -112,6 +114,8 @@ SWGFreeDVModSettings::init() { m_reverse_api_channel_index_isSet = false; cw_keyer = new SWGCWKeyerSettings(); m_cw_keyer_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -143,6 +147,9 @@ SWGFreeDVModSettings::cleanup() { if(cw_keyer != nullptr) { delete cw_keyer; } + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGFreeDVModSettings* @@ -194,6 +201,8 @@ SWGFreeDVModSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings"); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -267,6 +276,9 @@ SWGFreeDVModSettings::asJsonObject() { if((cw_keyer != nullptr) && (cw_keyer->isSet())){ toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings")); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -461,6 +473,16 @@ SWGFreeDVModSettings::setCwKeyer(SWGCWKeyerSettings* cw_keyer) { this->m_cw_keyer_isSet = true; } +SWGGLSpectrum* +SWGFreeDVModSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGFreeDVModSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGFreeDVModSettings::isSet(){ @@ -523,6 +545,9 @@ SWGFreeDVModSettings::isSet(){ if(cw_keyer && cw_keyer->isSet()){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.h b/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.h index 2a175fb0e..4fb581b60 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGFreeDVModSettings.h @@ -23,6 +23,7 @@ #include "SWGCWKeyerSettings.h" +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -100,6 +101,9 @@ public: SWGCWKeyerSettings* getCwKeyer(); void setCwKeyer(SWGCWKeyerSettings* cw_keyer); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -161,6 +165,9 @@ private: SWGCWKeyerSettings* cw_keyer; bool m_cw_keyer_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.cpp index 7cf3fc4c2..d022fc010 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.cpp @@ -68,6 +68,8 @@ SWGFreqTrackerSettings::SWGFreqTrackerSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGFreqTrackerSettings::~SWGFreqTrackerSettings() { @@ -116,6 +118,8 @@ SWGFreqTrackerSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -144,6 +148,9 @@ SWGFreqTrackerSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGFreqTrackerSettings* @@ -197,6 +204,8 @@ SWGFreqTrackerSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -273,6 +282,9 @@ SWGFreqTrackerSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -477,6 +489,16 @@ SWGFreqTrackerSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_ind this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGFreqTrackerSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGFreqTrackerSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGFreqTrackerSettings::isSet(){ @@ -542,6 +564,9 @@ SWGFreqTrackerSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.h b/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.h index 144c22f38..9ab2a0019 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGFreqTrackerSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -102,6 +103,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -166,6 +170,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGGLScope.cpp b/swagger/sdrangel/code/qt5/client/SWGGLScope.cpp index 62522b6f2..f1dca7dad 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGLScope.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGGLScope.cpp @@ -38,8 +38,8 @@ SWGGLScope::SWGGLScope() { m_time_isSet = false; time_ofs = 0; m_time_ofs_isSet = false; - trace_len = 0; - m_trace_len_isSet = false; + trace_len_mult = 0; + m_trace_len_mult_isSet = false; trig_pre = 0; m_trig_pre_isSet = false; traces_data = nullptr; @@ -64,8 +64,8 @@ SWGGLScope::init() { m_time_isSet = false; time_ofs = 0; m_time_ofs_isSet = false; - trace_len = 0; - m_trace_len_isSet = false; + trace_len_mult = 0; + m_trace_len_mult_isSet = false; trig_pre = 0; m_trig_pre_isSet = false; traces_data = new QList(); @@ -120,7 +120,7 @@ SWGGLScope::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&time_ofs, pJson["timeOfs"], "qint32", ""); - ::SWGSDRangel::setValue(&trace_len, pJson["traceLen"], "qint32", ""); + ::SWGSDRangel::setValue(&trace_len_mult, pJson["traceLenMult"], "qint32", ""); ::SWGSDRangel::setValue(&trig_pre, pJson["trigPre"], "qint32", ""); @@ -159,8 +159,8 @@ SWGGLScope::asJsonObject() { if(m_time_ofs_isSet){ obj->insert("timeOfs", QJsonValue(time_ofs)); } - if(m_trace_len_isSet){ - obj->insert("traceLen", QJsonValue(trace_len)); + if(m_trace_len_mult_isSet){ + obj->insert("traceLenMult", QJsonValue(trace_len_mult)); } if(m_trig_pre_isSet){ obj->insert("trigPre", QJsonValue(trig_pre)); @@ -226,13 +226,13 @@ SWGGLScope::setTimeOfs(qint32 time_ofs) { } qint32 -SWGGLScope::getTraceLen() { - return trace_len; +SWGGLScope::getTraceLenMult() { + return trace_len_mult; } void -SWGGLScope::setTraceLen(qint32 trace_len) { - this->trace_len = trace_len; - this->m_trace_len_isSet = true; +SWGGLScope::setTraceLenMult(qint32 trace_len_mult) { + this->trace_len_mult = trace_len_mult; + this->m_trace_len_mult_isSet = true; } qint32 @@ -285,7 +285,7 @@ SWGGLScope::isSet(){ if(m_time_ofs_isSet){ isObjectUpdated = true; break; } - if(m_trace_len_isSet){ + if(m_trace_len_mult_isSet){ isObjectUpdated = true; break; } if(m_trig_pre_isSet){ diff --git a/swagger/sdrangel/code/qt5/client/SWGGLScope.h b/swagger/sdrangel/code/qt5/client/SWGGLScope.h index 3ea795168..40c67cd01 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGLScope.h +++ b/swagger/sdrangel/code/qt5/client/SWGGLScope.h @@ -59,8 +59,8 @@ public: qint32 getTimeOfs(); void setTimeOfs(qint32 time_ofs); - qint32 getTraceLen(); - void setTraceLen(qint32 trace_len); + qint32 getTraceLenMult(); + void setTraceLenMult(qint32 trace_len_mult); qint32 getTrigPre(); void setTrigPre(qint32 trig_pre); @@ -90,8 +90,8 @@ private: qint32 time_ofs; bool m_time_ofs_isSet; - qint32 trace_len; - bool m_trace_len_isSet; + qint32 trace_len_mult; + bool m_trace_len_mult_isSet; qint32 trig_pre; bool m_trig_pre_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.cpp b/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.cpp index cd7c78e49..2be71acb2 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.cpp @@ -74,6 +74,8 @@ SWGGLSpectrum::SWGGLSpectrum() { m_ssb_isSet = false; usb = 0; m_usb_isSet = false; + ws_spectrum = 0; + m_ws_spectrum_isSet = false; ws_spectrum_address = nullptr; m_ws_spectrum_address_isSet = false; ws_spectrum_port = 0; @@ -132,6 +134,8 @@ SWGGLSpectrum::init() { m_ssb_isSet = false; usb = 0; m_usb_isSet = false; + ws_spectrum = 0; + m_ws_spectrum_isSet = false; ws_spectrum_address = new QString(""); m_ws_spectrum_address_isSet = false; ws_spectrum_port = 0; @@ -161,6 +165,7 @@ SWGGLSpectrum::cleanup() { + if(ws_spectrum_address != nullptr) { @@ -226,6 +231,8 @@ SWGGLSpectrum::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&usb, pJson["usb"], "qint32", ""); + ::SWGSDRangel::setValue(&ws_spectrum, pJson["wsSpectrum"], "qint32", ""); + ::SWGSDRangel::setValue(&ws_spectrum_address, pJson["wsSpectrumAddress"], "QString", "QString"); ::SWGSDRangel::setValue(&ws_spectrum_port, pJson["wsSpectrumPort"], "qint32", ""); @@ -315,6 +322,9 @@ SWGGLSpectrum::asJsonObject() { if(m_usb_isSet){ obj->insert("usb", QJsonValue(usb)); } + if(m_ws_spectrum_isSet){ + obj->insert("wsSpectrum", QJsonValue(ws_spectrum)); + } if(ws_spectrum_address != nullptr && *ws_spectrum_address != QString("")){ toJsonValue(QString("wsSpectrumAddress"), ws_spectrum_address, obj, QString("QString")); } @@ -555,6 +565,16 @@ SWGGLSpectrum::setUsb(qint32 usb) { this->m_usb_isSet = true; } +qint32 +SWGGLSpectrum::getWsSpectrum() { + return ws_spectrum; +} +void +SWGGLSpectrum::setWsSpectrum(qint32 ws_spectrum) { + this->ws_spectrum = ws_spectrum; + this->m_ws_spectrum_isSet = true; +} + QString* SWGGLSpectrum::getWsSpectrumAddress() { return ws_spectrum_address; @@ -649,6 +669,9 @@ SWGGLSpectrum::isSet(){ if(m_usb_isSet){ isObjectUpdated = true; break; } + if(m_ws_spectrum_isSet){ + isObjectUpdated = true; break; + } if(ws_spectrum_address && *ws_spectrum_address != QString("")){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.h b/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.h index ed2c021a3..beb29f00b 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.h +++ b/swagger/sdrangel/code/qt5/client/SWGGLSpectrum.h @@ -111,6 +111,9 @@ public: qint32 getUsb(); void setUsb(qint32 usb); + qint32 getWsSpectrum(); + void setWsSpectrum(qint32 ws_spectrum); + QString* getWsSpectrumAddress(); void setWsSpectrumAddress(QString* ws_spectrum_address); @@ -190,6 +193,9 @@ private: qint32 usb; bool m_usb_isSet; + qint32 ws_spectrum; + bool m_ws_spectrum_isSet; + QString* ws_spectrum_address; bool m_ws_spectrum_address_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index 0b4f3aaef..55f71bde5 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -70,6 +70,7 @@ #include "SWGChannelAnalyzerSettings.h" #include "SWGChannelConfig.h" #include "SWGChannelListItem.h" +#include "SWGChannelMarker.h" #include "SWGChannelReport.h" #include "SWGChannelSettings.h" #include "SWGChannelsDetail.h" @@ -588,6 +589,11 @@ namespace SWGSDRangel { obj->init(); return obj; } + if(QString("SWGChannelMarker").compare(type) == 0) { + SWGChannelMarker *obj = new SWGChannelMarker(); + obj->init(); + return obj; + } if(QString("SWGChannelReport").compare(type) == 0) { SWGChannelReport *obj = new SWGChannelReport(); obj->init(); diff --git a/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.cpp index 2f89430c2..e6aa21137 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.cpp @@ -74,6 +74,8 @@ SWGSSBDemodSettings::SWGSSBDemodSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGSSBDemodSettings::~SWGSSBDemodSettings() { @@ -128,6 +130,8 @@ SWGSSBDemodSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -161,6 +165,9 @@ SWGSSBDemodSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGSSBDemodSettings* @@ -220,6 +227,8 @@ SWGSSBDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -305,6 +314,9 @@ SWGSSBDemodSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -539,6 +551,16 @@ SWGSSBDemodSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGSSBDemodSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGSSBDemodSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGSSBDemodSettings::isSet(){ @@ -613,6 +635,9 @@ SWGSSBDemodSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.h index 67dd3ebf0..4a551b1a4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGSSBDemodSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -111,6 +112,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -184,6 +188,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp index b1a91c482..934cb90c4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.cpp @@ -80,6 +80,8 @@ SWGSSBModSettings::SWGSSBModSettings() { m_reverse_api_channel_index_isSet = false; cw_keyer = nullptr; m_cw_keyer_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGSSBModSettings::~SWGSSBModSettings() { @@ -140,6 +142,8 @@ SWGSSBModSettings::init() { m_reverse_api_channel_index_isSet = false; cw_keyer = new SWGCWKeyerSettings(); m_cw_keyer_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -178,6 +182,9 @@ SWGSSBModSettings::cleanup() { if(cw_keyer != nullptr) { delete cw_keyer; } + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGSSBModSettings* @@ -243,6 +250,8 @@ SWGSSBModSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings"); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -337,6 +346,9 @@ SWGSSBModSettings::asJsonObject() { if((cw_keyer != nullptr) && (cw_keyer->isSet())){ toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings")); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -601,6 +613,16 @@ SWGSSBModSettings::setCwKeyer(SWGCWKeyerSettings* cw_keyer) { this->m_cw_keyer_isSet = true; } +SWGGLSpectrum* +SWGSSBModSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGSSBModSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGSSBModSettings::isSet(){ @@ -684,6 +706,9 @@ SWGSSBModSettings::isSet(){ if(cw_keyer && cw_keyer->isSet()){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h index 08d545a63..4d26fb639 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGSSBModSettings.h @@ -23,6 +23,7 @@ #include "SWGCWKeyerSettings.h" +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -121,6 +122,9 @@ public: SWGCWKeyerSettings* getCwKeyer(); void setCwKeyer(SWGCWKeyerSettings* cw_keyer); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -203,6 +207,9 @@ private: SWGCWKeyerSettings* cw_keyer; bool m_cw_keyer_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.cpp index 6aa5fdfcb..350629960 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.cpp @@ -60,6 +60,8 @@ SWGSigMFFileSinkSettings::SWGSigMFFileSinkSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGSigMFFileSinkSettings::~SWGSigMFFileSinkSettings() { @@ -100,6 +102,8 @@ SWGSigMFFileSinkSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -126,6 +130,9 @@ SWGSigMFFileSinkSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGSigMFFileSinkSettings* @@ -171,6 +178,8 @@ SWGSigMFFileSinkSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -235,6 +244,9 @@ SWGSigMFFileSinkSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -399,6 +411,16 @@ SWGSigMFFileSinkSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_i this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGSigMFFileSinkSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGSigMFFileSinkSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGSigMFFileSinkSettings::isSet(){ @@ -452,6 +474,9 @@ SWGSigMFFileSinkSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.h b/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.h index c8560af26..cc871ef98 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGSigMFFileSinkSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -90,6 +91,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -142,6 +146,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.cpp index feea57cbc..58862f397 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.cpp @@ -78,6 +78,8 @@ SWGUDPSinkSettings::SWGUDPSinkSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGUDPSinkSettings::~SWGUDPSinkSettings() { @@ -136,6 +138,8 @@ SWGUDPSinkSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -171,6 +175,9 @@ SWGUDPSinkSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGUDPSinkSettings* @@ -234,6 +241,8 @@ SWGUDPSinkSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -325,6 +334,9 @@ SWGUDPSinkSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -579,6 +591,16 @@ SWGUDPSinkSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGUDPSinkSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGUDPSinkSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGUDPSinkSettings::isSet(){ @@ -659,6 +681,9 @@ SWGUDPSinkSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.h b/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.h index 1e2e7e4bf..f280b3125 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGUDPSinkSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -117,6 +118,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -196,6 +200,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.cpp index 70213cfe5..40a171660 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.cpp @@ -82,6 +82,8 @@ SWGUDPSourceSettings::SWGUDPSourceSettings() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = nullptr; + m_spectrum_config_isSet = false; } SWGUDPSourceSettings::~SWGUDPSourceSettings() { @@ -144,6 +146,8 @@ SWGUDPSourceSettings::init() { m_reverse_api_device_index_isSet = false; reverse_api_channel_index = 0; m_reverse_api_channel_index_isSet = false; + spectrum_config = new SWGGLSpectrum(); + m_spectrum_config_isSet = false; } void @@ -183,6 +187,9 @@ SWGUDPSourceSettings::cleanup() { + if(spectrum_config != nullptr) { + delete spectrum_config; + } } SWGUDPSourceSettings* @@ -250,6 +257,8 @@ SWGUDPSourceSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum"); + } QString @@ -347,6 +356,9 @@ SWGUDPSourceSettings::asJsonObject() { if(m_reverse_api_channel_index_isSet){ obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); } + if((spectrum_config != nullptr) && (spectrum_config->isSet())){ + toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum")); + } return obj; } @@ -621,6 +633,16 @@ SWGUDPSourceSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index this->m_reverse_api_channel_index_isSet = true; } +SWGGLSpectrum* +SWGUDPSourceSettings::getSpectrumConfig() { + return spectrum_config; +} +void +SWGUDPSourceSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) { + this->spectrum_config = spectrum_config; + this->m_spectrum_config_isSet = true; +} + bool SWGUDPSourceSettings::isSet(){ @@ -707,6 +729,9 @@ SWGUDPSourceSettings::isSet(){ if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break; } + if(spectrum_config && spectrum_config->isSet()){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.h b/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.h index 7a8d17d8c..b27663825 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGUDPSourceSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGGLSpectrum.h" #include #include "SWGObject.h" @@ -123,6 +124,9 @@ public: qint32 getReverseApiChannelIndex(); void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + SWGGLSpectrum* getSpectrumConfig(); + void setSpectrumConfig(SWGGLSpectrum* spectrum_config); + virtual bool isSet() override; @@ -208,6 +212,9 @@ private: qint32 reverse_api_channel_index; bool m_reverse_api_channel_index_isSet; + SWGGLSpectrum* spectrum_config; + bool m_spectrum_config_isSet; + }; }