1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

REST API: Channel Analyzer settings (1)

This commit is contained in:
f4exb 2019-08-08 18:42:17 +02:00
parent 524326de6d
commit 3ecb73e36e
17 changed files with 296 additions and 38 deletions

View File

@ -5,7 +5,7 @@ set(chanalyzer_SOURCES
chanalyzergui.cpp chanalyzergui.cpp
chanalyzerplugin.cpp chanalyzerplugin.cpp
chanalyzersettings.cpp chanalyzersettings.cpp
chanalyzerwebapiadapter.cpp
chanalyzergui.ui chanalyzergui.ui
) )
@ -14,6 +14,11 @@ set(chanalyzer_HEADERS
chanalyzergui.h chanalyzergui.h
chanalyzerplugin.h chanalyzerplugin.h
chanalyzersettings.h chanalyzersettings.h
chanalyzerwebapiadapter.h
)
include_directories(
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
) )
include_directories( include_directories(

View File

@ -21,10 +21,11 @@
#include "chanalyzer.h" #include "chanalyzer.h"
#include "chanalyzerplugin.h" #include "chanalyzerplugin.h"
#include "chanalyzergui.h" #include "chanalyzergui.h"
#include "chanalyzerwebapiadapter.h"
const PluginDescriptor ChannelAnalyzerPlugin::m_pluginDescriptor = { const PluginDescriptor ChannelAnalyzerPlugin::m_pluginDescriptor = {
QString("Channel Analyzer"), QString("Channel Analyzer"),
QString("4.5.1"), QString("4.11.6"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,
@ -65,3 +66,7 @@ ChannelAPI* ChannelAnalyzerPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const
return new ChannelAnalyzer(deviceAPI); return new ChannelAnalyzer(deviceAPI);
} }
ChannelWebAPIAdapter* ChannelAnalyzerPlugin::createChannelWebAPIAdapter() const
{
return new ChannelAnalyzerWebAPIAdapter();
}

View File

@ -39,6 +39,7 @@ public:
virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const;
virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const;
virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const;
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const;
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;

View File

@ -15,6 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QString>
#include "SWGChannelSettings.h" #include "SWGChannelSettings.h"
#include "chanalyzerwebapiadapter.h" #include "chanalyzerwebapiadapter.h"
@ -27,6 +29,17 @@ ChannelAnalyzerWebAPIAdapter::ChannelAnalyzerWebAPIAdapter()
ChannelAnalyzerWebAPIAdapter::~ChannelAnalyzerWebAPIAdapter() ChannelAnalyzerWebAPIAdapter::~ChannelAnalyzerWebAPIAdapter()
{} {}
int ChannelAnalyzerWebAPIAdapter::webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage)
{
(void) errorMessage;
response.setChannelAnalyzerSettings(new SWGSDRangel::SWGChannelAnalyzerSettings());
response.getChannelAnalyzerSettings()->init();
webapiFormatChannelSettings(response, m_settings, m_glScopeSettings, m_glSpectrumSettings);
return 200;
}
void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings( void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
const ChannelAnalyzerSettings& settings, const ChannelAnalyzerSettings& settings,
@ -48,6 +61,8 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
response.getChannelAnalyzerSettings()->setInputType((int) settings.m_inputType); response.getChannelAnalyzerSettings()->setInputType((int) settings.m_inputType);
response.getChannelAnalyzerSettings()->setRgbColor(settings.m_rgbColor); response.getChannelAnalyzerSettings()->setRgbColor(settings.m_rgbColor);
response.getChannelAnalyzerSettings()->setTitle(new QString(settings.m_title)); response.getChannelAnalyzerSettings()->setTitle(new QString(settings.m_title));
// scope
SWGSDRangel::SWGGLScope *swgScope = new SWGSDRangel::SWGGLScope(); SWGSDRangel::SWGGLScope *swgScope = new SWGSDRangel::SWGGLScope();
swgScope->init(); swgScope->init();
response.getChannelAnalyzerSettings()->setScopeConfig(swgScope); response.getChannelAnalyzerSettings()->setScopeConfig(swgScope);
@ -58,8 +73,61 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
swgScope->setTraceIntensity(scopeSettings.m_traceIntensity); swgScope->setTraceIntensity(scopeSettings.m_traceIntensity);
swgScope->setTraceLen(scopeSettings.m_traceLen); swgScope->setTraceLen(scopeSettings.m_traceLen);
swgScope->setTrigPre(scopeSettings.m_trigPre); swgScope->setTrigPre(scopeSettings.m_trigPre);
// TODO array of traces
// TODO array of triggers // array of traces
swgScope->setTracesData(new QList<SWGSDRangel::SWGTraceData *>);
std::vector<GLScopeSettings::TraceData>::const_iterator traceIt = scopeSettings.m_tracesData.begin();
for (; traceIt != scopeSettings.m_tracesData.end(); ++traceIt)
{
swgScope->getTracesData()->append(new SWGSDRangel::SWGTraceData);
swgScope->getTracesData()->back()->setAmp(traceIt->m_amp);
swgScope->getTracesData()->back()->setAmpIndex(traceIt->m_ampIndex);
swgScope->getTracesData()->back()->setHasTextOverlay(traceIt->m_hasTextOverlay ? 1 : 0);
swgScope->getTracesData()->back()->setInputIndex(traceIt->m_inputIndex);
swgScope->getTracesData()->back()->setOfs(traceIt->m_ofs);
swgScope->getTracesData()->back()->setOfsCoarse(traceIt->m_ofsCoarse);
swgScope->getTracesData()->back()->setOfsFine(traceIt->m_ofsFine);
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<SWGSDRangel::SWGTriggerData *>);
std::vector<GLScopeSettings::TriggerData>::const_iterator triggerIt = scopeSettings.m_triggersData.begin();
for (; triggerIt != scopeSettings.m_triggersData.end(); ++triggerIt)
{
swgScope->getTriggersData()->append(new SWGSDRangel::SWGTriggerData);
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);
}
// spectrum
SWGSDRangel::SWGGLSpectrum *swgSpectrum = new SWGSDRangel::SWGGLSpectrum(); SWGSDRangel::SWGGLSpectrum *swgSpectrum = new SWGSDRangel::SWGGLSpectrum();
swgSpectrum->init(); swgSpectrum->init();
response.getChannelAnalyzerSettings()->setSpectrumConfig(swgSpectrum); response.getChannelAnalyzerSettings()->setSpectrumConfig(swgSpectrum);
@ -76,7 +144,17 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
swgSpectrum->setDisplayWaterfall(spectrumSettings.m_displayWaterfall ? 1 : 0); swgSpectrum->setDisplayWaterfall(spectrumSettings.m_displayWaterfall ? 1 : 0);
swgSpectrum->setFftOverlap(spectrumSettings.m_fftOverlap); swgSpectrum->setFftOverlap(spectrumSettings.m_fftOverlap);
swgSpectrum->setFftSize(spectrumSettings.m_fftSize); swgSpectrum->setFftSize(spectrumSettings.m_fftSize);
}
int ChannelAnalyzerWebAPIAdapter::webapiSettingsPutPatch(
bool force,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage)
{
(void) force;
(void) errorMessage;
webapiUpdateChannelSettings(m_settings, m_glScopeSettings, m_glSpectrumSettings, channelSettingsKeys, response);
} }
void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings( void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
@ -86,6 +164,72 @@ void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response) SWGSDRangel::SWGChannelSettings& response)
{ {
if (channelSettingsKeys.contains("frequency")) {
settings.m_frequency = response.getChannelAnalyzerSettings()->getFrequency();
}
if (channelSettingsKeys.contains("downSample")) {
settings.m_downSample = response.getChannelAnalyzerSettings()->getDownSample() != 0;
}
if (channelSettingsKeys.contains("downSampleRate")) {
settings.m_downSampleRate = response.getChannelAnalyzerSettings()->getDownSampleRate();
}
if (channelSettingsKeys.contains("bandwidth")) {
settings.m_bandwidth = response.getChannelAnalyzerSettings()->getBandwidth();
}
if (channelSettingsKeys.contains("lowCutoff")) {
settings.m_lowCutoff = response.getChannelAnalyzerSettings()->getLowCutoff();
}
if (channelSettingsKeys.contains("spanLog2")) {
settings.m_spanLog2 = response.getChannelAnalyzerSettings()->getSpanLog2();
}
if (channelSettingsKeys.contains("ssb")) {
settings.m_ssb = response.getChannelAnalyzerSettings()->getSsb() != 0;
}
if (channelSettingsKeys.contains("pll")) {
settings.m_pll = response.getChannelAnalyzerSettings()->getPll() != 0;
}
if (channelSettingsKeys.contains("fll")) {
settings.m_fll = response.getChannelAnalyzerSettings()->getFll() != 0;
}
if (channelSettingsKeys.contains("rrc")) {
settings.m_rrc = response.getChannelAnalyzerSettings()->getRrc() != 0;
}
if (channelSettingsKeys.contains("rrcRolloff")) {
settings.m_rrcRolloff = response.getChannelAnalyzerSettings()->getRrcRolloff();
}
if (channelSettingsKeys.contains("pllPskOrder")) {
settings.m_pllPskOrder = response.getChannelAnalyzerSettings()->getPllPskOrder();
}
if (channelSettingsKeys.contains("inputType")) {
settings.m_inputType = (ChannelAnalyzerSettings::InputType) response.getChannelAnalyzerSettings()->getInputType();
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getChannelAnalyzerSettings()->getRgbColor();
}
if (channelSettingsKeys.contains("title")) {
settings.m_title = *response.getChannelAnalyzerSettings()->getTitle();
}
// scope
if (channelSettingsKeys.contains("scopeConfig.displayMode")) {
scopeSettings.m_displayMode = (GLScopeSettings::DisplayMode) response.getChannelAnalyzerSettings()->getScopeConfig()->getDisplayMode();
}
// TODO ...
for (int i = 0; i < 10; i++) // no more than 10 traces anyway
{
// TODO ...
}
} }
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);
}

View File

@ -61,6 +61,9 @@ private:
ChannelAnalyzerSettings m_settings; ChannelAnalyzerSettings m_settings;
GLScopeSettings m_glScopeSettings; GLScopeSettings m_glScopeSettings;
GLSpectrumSettings m_glSpectrumSettings; GLSpectrumSettings m_glSpectrumSettings;
static int qColorToInt(const QColor& color);
static QColor intToQColor(int intColor);
}; };
#endif // INCLUDE_CHANALYZER_WEBAPIADAPTER_H #endif // INCLUDE_CHANALYZER_WEBAPIADAPTER_H

View File

@ -15,11 +15,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <QByteArray> #include <QByteArray>
#include <QColor> #include <QColor>
#include <vector>
#include "export.h" #include "export.h"
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "dsp/projector.h" #include "dsp/projector.h"

View File

@ -3187,7 +3187,7 @@ margin-bottom: 20px;
"$ref" : "#/definitions/TraceData" "$ref" : "#/definitions/TraceData"
} }
}, },
"m_triggersData" : { "triggersData" : {
"type" : "array", "type" : "array",
"items" : { "items" : {
"$ref" : "#/definitions/TriggerData" "$ref" : "#/definitions/TriggerData"
@ -27607,7 +27607,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2019-08-07T23:30:36.250+02:00 Generated 2019-08-08T13:54:12.590+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -140,7 +140,7 @@ GLScope:
type: array type: array
items: items:
$ref: "/doc/swagger/include/GLScope.yaml#/TraceData" $ref: "/doc/swagger/include/GLScope.yaml#/TraceData"
m_triggersData: triggersData:
type: array type: array
items: items:
$ref: "/doc/swagger/include/GLScope.yaml#/TriggerData" $ref: "/doc/swagger/include/GLScope.yaml#/TriggerData"

View File

@ -49,3 +49,78 @@ std::regex WebAPIAdapterInterface::devicesetChannelURLRe("^/sdrangel/deviceset/(
std::regex WebAPIAdapterInterface::devicesetChannelIndexURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})$"); std::regex WebAPIAdapterInterface::devicesetChannelIndexURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})$");
std::regex WebAPIAdapterInterface::devicesetChannelSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/settings$"); std::regex WebAPIAdapterInterface::devicesetChannelSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/settings$");
std::regex WebAPIAdapterInterface::devicesetChannelReportURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/report"); std::regex WebAPIAdapterInterface::devicesetChannelReportURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/report");
void WebAPIAdapterInterface::ConfigKeys::debug()
{
qDebug("WebAPIAdapterInterface::ConfigKeys::debug");
qDebug("preferences:");
foreach(QString preferenceKey, m_preferencesKeys) {
qDebug(" %s", qPrintable(preferenceKey));
}
qDebug("commands:");
foreach(CommandKeys commandKeys, m_commandKeys)
{
qDebug(" {");
foreach(QString commandKey, commandKeys.m_keys) {
qDebug(" %s", qPrintable(commandKey));
}
qDebug(" }");
}
qDebug("presets:");
foreach(PresetKeys presetKeys, m_presetKeys)
{
qDebug(" {");
foreach(QString presetKey, presetKeys.m_keys) {
qDebug(" %s", qPrintable(presetKey));
}
qDebug(" deviceConfigs:");
foreach(DeviceKeys deviceKeys, presetKeys.m_devicesKeys)
{
qDebug(" {");
qDebug(" config:");
foreach(QString deviceKey, deviceKeys.m_deviceKeys) {
qDebug(" %s", qPrintable(deviceKey));
}
qDebug(" }");
}
qDebug(" channelConfigs");
foreach(ChannelKeys channelKeys, presetKeys.m_channelsKeys)
{
qDebug(" {");
qDebug(" config:");
foreach(QString channelKey, channelKeys.m_channelKeys) {
qDebug(" %s", qPrintable(channelKey));
}
qDebug(" }");
}
qDebug(" }");
}
qDebug("workingPreset:");
foreach(QString presetKey, m_workingPresetKeys.m_keys) {
qDebug(" %s", qPrintable(presetKey));
}
qDebug(" deviceConfigs:");
foreach(DeviceKeys deviceKeys, m_workingPresetKeys.m_devicesKeys)
{
qDebug(" {");
qDebug(" config:");
foreach(QString deviceKey, deviceKeys.m_deviceKeys) {
qDebug(" %s", qPrintable(deviceKey));
}
qDebug(" }");
}
qDebug(" channelConfigs:");
foreach(ChannelKeys channelKeys, m_workingPresetKeys.m_channelsKeys)
{
qDebug(" {");
qDebug(" config:");
foreach(QString channelKey, channelKeys.m_channelKeys) {
qDebug(" %s", qPrintable(channelKey));
}
qDebug(" }");
}
}

View File

@ -89,6 +89,7 @@ public:
PresetKeys m_workingPresetKeys; PresetKeys m_workingPresetKeys;
QList<PresetKeys> m_presetKeys; QList<PresetKeys> m_presetKeys;
QList<CommandKeys> m_commandKeys; QList<CommandKeys> m_commandKeys;
void debug();
}; };
virtual ~WebAPIAdapterInterface() {} virtual ~WebAPIAdapterInterface() {}

View File

@ -53,6 +53,7 @@ const QMap<QString, QString> WebAPIRequestMapper::m_channelURIToSettingsKey = {
{"sdrangel.channeltx.ammod", "AMModSettings"}, {"sdrangel.channeltx.ammod", "AMModSettings"},
{"sdrangel.channeltx.atvmod", "ATVModSettings"}, {"sdrangel.channeltx.atvmod", "ATVModSettings"},
{"sdrangel.channel.bfm", "BFMDemodSettings"}, {"sdrangel.channel.bfm", "BFMDemodSettings"},
{"sdrangel.channel.chanalyzer", "ChannelAnalyzerSettings"},
{"sdrangel.channel.dsddemod", "DSDDemodSettings"}, {"sdrangel.channel.dsddemod", "DSDDemodSettings"},
{"sdrangel.channeltx.filesrc", "FileSourceSettings"}, {"sdrangel.channeltx.filesrc", "FileSourceSettings"},
{"sdrangel.channel.freedvdemod", "FreeDVDemodSettings"}, {"sdrangel.channel.freedvdemod", "FreeDVDemodSettings"},
@ -117,6 +118,7 @@ const QMap<QString, QString> WebAPIRequestMapper::m_channelTypeToSettingsKey = {
{"AMMod", "AMModSettings"}, {"AMMod", "AMModSettings"},
{"ATVMod", "ATVModSettings"}, {"ATVMod", "ATVModSettings"},
{"BFMDemod", "BFMDemodSettings"}, {"BFMDemod", "BFMDemodSettings"},
{"ChannelAnalyzer", "ChannelAnalyzerSettings"},
{"DSDDemod", "DSDDemodSettings"}, {"DSDDemod", "DSDDemodSettings"},
{"FileSource", "FileSourceSettings"}, {"FileSource", "FileSourceSettings"},
{"FreeDVDemod", "FreeDVDemodSettings"}, {"FreeDVDemod", "FreeDVDemodSettings"},
@ -375,6 +377,7 @@ void WebAPIRequestMapper::instanceConfigService(qtwebapp::HttpRequest& request,
if (validateConfig(query, jsonObject, configKeys)) if (validateConfig(query, jsonObject, configKeys))
{ {
configKeys.debug();
int status = m_adapter->instanceConfigPutPatch( int status = m_adapter->instanceConfigPutPatch(
true, true,
query, query,
@ -2254,11 +2257,26 @@ bool WebAPIRequestMapper::validateConfig(SWGSDRangel::SWGInstanceConfigResponse&
} }
} }
if (jsonObject.contains("presets"))
{
QJsonArray presetsJson = jsonObject["presets"].toArray();
QJsonArray::const_iterator presetsIt = presetsJson.begin();
for (; presetsIt != presetsJson.end(); ++presetsIt)
{
SWGSDRangel::SWGPreset *preset = new SWGSDRangel::SWGPreset();
QJsonObject presetJson = presetsIt->toObject();
configKeys.m_presetKeys.append(WebAPIAdapterInterface::PresetKeys());
appendPresetKeys(preset, presetJson, configKeys.m_presetKeys.back());
}
}
if (jsonObject.contains("workingPreset")) if (jsonObject.contains("workingPreset"))
{ {
SWGSDRangel::SWGPreset *workingPreset = new SWGSDRangel::SWGPreset(); SWGSDRangel::SWGPreset *preset = new SWGSDRangel::SWGPreset();
config.setWorkingPreset(preset);
QJsonObject presetJson = jsonObject["workingPreset"].toObject(); QJsonObject presetJson = jsonObject["workingPreset"].toObject();
appendPresetKeys(workingPreset, presetJson, configKeys.m_workingPresetKeys); appendPresetKeys(preset, presetJson, configKeys.m_workingPresetKeys);
} }
return true; return true;
@ -2413,6 +2431,11 @@ bool WebAPIRequestMapper::getChannel(
channelSettings->setBfmDemodSettings(new SWGSDRangel::SWGBFMDemodSettings()); channelSettings->setBfmDemodSettings(new SWGSDRangel::SWGBFMDemodSettings());
channelSettings->getBfmDemodSettings()->fromJsonObject(settingsJsonObject); channelSettings->getBfmDemodSettings()->fromJsonObject(settingsJsonObject);
} }
else if (channelSettingsKey == "ChannelAnalyzerSettings")
{
channelSettings->setChannelAnalyzerSettings(new SWGSDRangel::SWGChannelAnalyzerSettings());
channelSettings->getChannelAnalyzerSettings()->fromJsonObject(settingsJsonObject);
}
else if (channelSettingsKey == "DSDDemodSettings") else if (channelSettingsKey == "DSDDemodSettings")
{ {
channelSettings->setDsdDemodSettings(new SWGSDRangel::SWGDSDDemodSettings()); channelSettings->setDsdDemodSettings(new SWGSDRangel::SWGDSDDemodSettings());

View File

@ -29,6 +29,7 @@ WebAPIServer::WebAPIServer(const QString& host, uint16_t port, WebAPIRequestMapp
{ {
m_settings.host = host; m_settings.host = host;
m_settings.port = port; m_settings.port = port;
m_settings.maxRequestSize = 1<<23; // 8M
} }
WebAPIServer::~WebAPIServer() WebAPIServer::~WebAPIServer()

View File

@ -32,7 +32,7 @@ ChannelAnalyzerSettings:
pllPskOrder: pllPskOrder:
type: integer type: integer
inputType: inputType:
description: see ChannelAnalyzer::InputType description: see ChannelAnalyzerSettings::InputType
type: integer type: integer
rgbColor: rgbColor:
type: integer type: integer

View File

@ -140,7 +140,7 @@ GLScope:
type: array type: array
items: items:
$ref: "http://localhost:8081/api/swagger/include/GLScope.yaml#/TraceData" $ref: "http://localhost:8081/api/swagger/include/GLScope.yaml#/TraceData"
m_triggersData: triggersData:
type: array type: array
items: items:
$ref: "http://localhost:8081/api/swagger/include/GLScope.yaml#/TriggerData" $ref: "http://localhost:8081/api/swagger/include/GLScope.yaml#/TriggerData"

View File

@ -3187,7 +3187,7 @@ margin-bottom: 20px;
"$ref" : "#/definitions/TraceData" "$ref" : "#/definitions/TraceData"
} }
}, },
"m_triggersData" : { "triggersData" : {
"type" : "array", "type" : "array",
"items" : { "items" : {
"$ref" : "#/definitions/TriggerData" "$ref" : "#/definitions/TriggerData"
@ -27607,7 +27607,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2019-08-07T23:30:36.250+02:00 Generated 2019-08-08T13:54:12.590+02:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -44,8 +44,8 @@ SWGGLScope::SWGGLScope() {
m_trig_pre_isSet = false; m_trig_pre_isSet = false;
traces_data = nullptr; traces_data = nullptr;
m_traces_data_isSet = false; m_traces_data_isSet = false;
m_triggers_data = nullptr; triggers_data = nullptr;
m_m_triggers_data_isSet = false; m_triggers_data_isSet = false;
} }
SWGGLScope::~SWGGLScope() { SWGGLScope::~SWGGLScope() {
@ -70,8 +70,8 @@ SWGGLScope::init() {
m_trig_pre_isSet = false; m_trig_pre_isSet = false;
traces_data = new QList<SWGTraceData*>(); traces_data = new QList<SWGTraceData*>();
m_traces_data_isSet = false; m_traces_data_isSet = false;
m_triggers_data = new QList<SWGTriggerData*>(); triggers_data = new QList<SWGTriggerData*>();
m_m_triggers_data_isSet = false; m_triggers_data_isSet = false;
} }
void void
@ -90,12 +90,12 @@ SWGGLScope::cleanup() {
} }
delete traces_data; delete traces_data;
} }
if(m_triggers_data != nullptr) { if(triggers_data != nullptr) {
auto arr = m_triggers_data; auto arr = triggers_data;
for(auto o: *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete m_triggers_data; delete triggers_data;
} }
} }
@ -127,7 +127,7 @@ SWGGLScope::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&traces_data, pJson["tracesData"], "QList", "SWGTraceData"); ::SWGSDRangel::setValue(&traces_data, pJson["tracesData"], "QList", "SWGTraceData");
::SWGSDRangel::setValue(&m_triggers_data, pJson["m_triggersData"], "QList", "SWGTriggerData"); ::SWGSDRangel::setValue(&triggers_data, pJson["triggersData"], "QList", "SWGTriggerData");
} }
QString QString
@ -168,8 +168,8 @@ SWGGLScope::asJsonObject() {
if(traces_data && traces_data->size() > 0){ if(traces_data && traces_data->size() > 0){
toJsonArray((QList<void*>*)traces_data, obj, "tracesData", "SWGTraceData"); toJsonArray((QList<void*>*)traces_data, obj, "tracesData", "SWGTraceData");
} }
if(m_triggers_data && m_triggers_data->size() > 0){ if(triggers_data && triggers_data->size() > 0){
toJsonArray((QList<void*>*)m_triggers_data, obj, "m_triggersData", "SWGTriggerData"); toJsonArray((QList<void*>*)triggers_data, obj, "triggersData", "SWGTriggerData");
} }
return obj; return obj;
@ -256,13 +256,13 @@ SWGGLScope::setTracesData(QList<SWGTraceData*>* traces_data) {
} }
QList<SWGTriggerData*>* QList<SWGTriggerData*>*
SWGGLScope::getMTriggersData() { SWGGLScope::getTriggersData() {
return m_triggers_data; return triggers_data;
} }
void void
SWGGLScope::setMTriggersData(QList<SWGTriggerData*>* m_triggers_data) { SWGGLScope::setTriggersData(QList<SWGTriggerData*>* triggers_data) {
this->m_triggers_data = m_triggers_data; this->triggers_data = triggers_data;
this->m_m_triggers_data_isSet = true; this->m_triggers_data_isSet = true;
} }
@ -294,7 +294,7 @@ SWGGLScope::isSet(){
if(traces_data && (traces_data->size() > 0)){ if(traces_data && (traces_data->size() > 0)){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(m_triggers_data && (m_triggers_data->size() > 0)){ if(triggers_data && (triggers_data->size() > 0)){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
}while(false); }while(false);

View File

@ -68,8 +68,8 @@ public:
QList<SWGTraceData*>* getTracesData(); QList<SWGTraceData*>* getTracesData();
void setTracesData(QList<SWGTraceData*>* traces_data); void setTracesData(QList<SWGTraceData*>* traces_data);
QList<SWGTriggerData*>* getMTriggersData(); QList<SWGTriggerData*>* getTriggersData();
void setMTriggersData(QList<SWGTriggerData*>* m_triggers_data); void setTriggersData(QList<SWGTriggerData*>* triggers_data);
virtual bool isSet() override; virtual bool isSet() override;
@ -99,8 +99,8 @@ private:
QList<SWGTraceData*>* traces_data; QList<SWGTraceData*>* traces_data;
bool m_traces_data_isSet; bool m_traces_data_isSet;
QList<SWGTriggerData*>* m_triggers_data; QList<SWGTriggerData*>* triggers_data;
bool m_m_triggers_data_isSet; bool m_triggers_data_isSet;
}; };