mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 05:41:56 -05:00
REST API: config: fixes (2)
This commit is contained in:
parent
6a0038e5bd
commit
ec22056cbf
@ -238,6 +238,7 @@ void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
|
||||
if (channelSettingsKeys.contains("scopeConfig.tracesData"))
|
||||
{
|
||||
QList<SWGSDRangel::SWGTraceData *> *tracesData = response.getChannelAnalyzerSettings()->getScopeConfig()->getTracesData();
|
||||
scopeSettings.m_tracesData.clear();
|
||||
|
||||
for (int i = 0; i < 10; i++) // no more than 10 traces anyway
|
||||
{
|
||||
@ -308,6 +309,7 @@ void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
|
||||
if (channelSettingsKeys.contains("scopeConfig.triggersData"))
|
||||
{
|
||||
QList<SWGSDRangel::SWGTriggerData *> *triggersData = response.getChannelAnalyzerSettings()->getScopeConfig()->getTriggersData();
|
||||
scopeSettings.m_triggersData.clear();
|
||||
|
||||
for (int i = 0; i < 10; i++) // no more than 10 triggers anyway
|
||||
{
|
||||
|
@ -1440,6 +1440,10 @@ void SoapySDRInput::webapiUpdateDeviceSettings(
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response)
|
||||
{
|
||||
for (int i = 0; i < deviceSettingsKeys.count(); i++) {
|
||||
qDebug("SoapySDRInput::webapiUpdateDeviceSettings %s", qPrintable(deviceSettingsKeys.at(i)));
|
||||
}
|
||||
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getSoapySdrInputSettings()->getCenterFrequency();
|
||||
}
|
||||
@ -1490,6 +1494,11 @@ void SoapySDRInput::webapiUpdateDeviceSettings(
|
||||
QVariant v = webapiVariantFromArgValue(itArg);
|
||||
itSettings.value() = v.toDouble();
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant v = webapiVariantFromArgValue(itArg);
|
||||
settings.m_tunableElements.insert(*itArg->getKey(), v.toDouble());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1510,6 +1519,11 @@ void SoapySDRInput::webapiUpdateDeviceSettings(
|
||||
QVariant v = webapiVariantFromArgValue(itArg);
|
||||
itSettings.value() = v.toDouble();
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant v = webapiVariantFromArgValue(itArg);
|
||||
settings.m_individualGains.insert(*itArg->getKey(), v.toDouble());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1543,6 +1557,8 @@ void SoapySDRInput::webapiUpdateDeviceSettings(
|
||||
|
||||
if (itSettings != settings.m_streamArgSettings.end()) {
|
||||
itSettings.value() = webapiVariantFromArgValue(itArg);
|
||||
} else {
|
||||
settings.m_streamArgSettings.insert(*itArg->getKey(), webapiVariantFromArgValue(itArg));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1557,6 +1573,8 @@ void SoapySDRInput::webapiUpdateDeviceSettings(
|
||||
|
||||
if (itSettings != settings.m_deviceArgSettings.end()) {
|
||||
itSettings.value() = webapiVariantFromArgValue(itArg);
|
||||
} else {
|
||||
settings.m_deviceArgSettings.insert(*itArg->getKey(), webapiVariantFromArgValue(itArg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ bool ChannelUtils::compareChannelURIs(const QString& registerdChannelURI, const
|
||||
|
||||
QString ChannelUtils::getRegisteredChannelURI(const QString& xChannelURI)
|
||||
{
|
||||
if (xChannelURI == "sdrangel.channel.chanalyzerng") {
|
||||
if ((xChannelURI == "sdrangel.channel.chanalyzerng")
|
||||
|| (xChannelURI == "org.f4exb.sdrangelove.channel.chanalyzer")) {
|
||||
return "sdrangel.channel.chanalyzer";
|
||||
} else if (xChannelURI == "de.maintech.sdrangelove.channel.am") {
|
||||
return "sdrangel.channel.amdemod";
|
||||
@ -34,6 +35,10 @@ QString ChannelUtils::getRegisteredChannelURI(const QString& xChannelURI)
|
||||
return "sdrangel.channel.ssbdemod";
|
||||
} else if (xChannelURI == "de.maintech.sdrangelove.channel.wfm") {
|
||||
return "sdrangel.channel.wfmdemod";
|
||||
} else if (xChannelURI == "sdrangel.channel.udpsrc") {
|
||||
return "sdrangel.channel.udpsink";
|
||||
} else if (xChannelURI == "sdrangel.channeltx.udpsink") {
|
||||
return "sdrangel.channeltx.udpsource";
|
||||
} else {
|
||||
return xChannelURI;
|
||||
}
|
||||
|
@ -26,8 +26,11 @@ QString DeviceUtils::getRegisteredDeviceURI(const QString& xDeviceURI)
|
||||
{
|
||||
if (xDeviceURI == "sdrangel.samplesource.bladerf") {
|
||||
return "sdrangel.samplesource.bladerf1input";
|
||||
} else if (xDeviceURI == "sdrangel.samplesource.bladerf1output") {
|
||||
} else if ((xDeviceURI == "sdrangel.samplesource.bladerf1output")
|
||||
|| (xDeviceURI == "sdrangel.samplesource.bladerfoutput")) {
|
||||
return "sdrangel.samplesink.bladerf1output";
|
||||
} else if (xDeviceURI == "sdrangel.samplesource.bladerf2output") {
|
||||
return "sdrangel.samplesink.bladerf2output";
|
||||
} else if (xDeviceURI == "sdrangel.samplesource.filesource") {
|
||||
return "sdrangel.samplesource.fileinput";
|
||||
} else if (xDeviceURI == "sdrangel.samplesource.hackrfoutput") {
|
||||
|
@ -18,6 +18,18 @@
|
||||
#include "util/simpleserializer.h"
|
||||
#include "glscopesettings.h"
|
||||
|
||||
const double GLScopeSettings::AMPS[27] = {
|
||||
2e-1, 1e-1, 5e-2,
|
||||
2e-2, 1e-2, 5e-3,
|
||||
2e-3, 1e-3, 5e-4,
|
||||
2e-4, 1e-4, 5e-5,
|
||||
2e-5, 1e-5, 5e-6,
|
||||
2e-6, 1e-6, 5e-7,
|
||||
2e-7, 1e-7, 5e-8,
|
||||
2e-8, 1e-8, 5e-9,
|
||||
2e-9, 1e-9, 5e-10,
|
||||
};
|
||||
|
||||
GLScopeSettings::GLScopeSettings()
|
||||
{
|
||||
resetToDefaults();
|
||||
@ -134,7 +146,8 @@ bool GLScopeSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(20 + 16*iTrace, &intValue, 0);
|
||||
m_tracesData.back().m_projectionType = (Projector::ProjectionType) intValue;
|
||||
d.readU32(21 + 16*iTrace, &uintValue, 0);
|
||||
m_tracesData.back().m_amp = uintValue;
|
||||
m_tracesData.back().m_ampIndex = uintValue;
|
||||
m_tracesData.back().m_amp = 0.2 / AMPS[m_tracesData.back().m_ampIndex < 27 ? m_tracesData.back().m_ampIndex : 26];
|
||||
d.readS32(22 + 16*iTrace, &intValue, 0);
|
||||
m_tracesData.back().m_ofsCoarse = intValue;
|
||||
d.readS32(23 + 16*iTrace, &intValue, 0);
|
||||
|
@ -157,6 +157,7 @@ public:
|
||||
int m_trigPre;
|
||||
std::vector<TraceData> m_tracesData;
|
||||
std::vector<TriggerData> m_triggersData;
|
||||
static const double AMPS[27];
|
||||
|
||||
GLScopeSettings();
|
||||
virtual ~GLScopeSettings();
|
||||
|
@ -318,19 +318,6 @@ void WebAPIAdapterBase::webapiUpdatePreset(
|
||||
|
||||
if (deviceWebAPIAdapter)
|
||||
{
|
||||
if (!force) // In PATCH mode you must find the exact device and deserialize its current settings to be able to patch it
|
||||
{
|
||||
const QByteArray *config = preset->findDeviceConfig(deviceId, deviceSerial, deviceSequence);
|
||||
|
||||
if (!config) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!deviceWebAPIAdapter->deserialize(*config)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
deviceWebAPIAdapter->webapiSettingsPutPatch(
|
||||
force,
|
||||
deviceKeysIt->m_deviceKeys,
|
||||
|
@ -50,33 +50,37 @@
|
||||
const QMap<QString, QString> WebAPIRequestMapper::m_channelURIToSettingsKey = {
|
||||
{"sdrangel.channel.amdemod", "AMDemodSettings"},
|
||||
{"de.maintech.sdrangelove.channel.am", "AMDemodSettings"}, // remap
|
||||
{"sdrangel.channeltx.ammod", "AMModSettings"},
|
||||
{"sdrangel.channeltx.atvmod", "ATVModSettings"},
|
||||
{"sdrangel.channeltx.modam", "AMModSettings"},
|
||||
{"sdrangel.channeltx.modatv", "ATVModSettings"},
|
||||
{"sdrangel.channel.bfm", "BFMDemodSettings"},
|
||||
{"sdrangel.channel.chanalyzer", "ChannelAnalyzerSettings"},
|
||||
{"sdrangel.channel.chanalyzerng", "ChannelAnalyzerSettings"}, // remap
|
||||
{"org.f4exb.sdrangelove.channel.chanalyzer", "ChannelAnalyzerSettings"}, // remap
|
||||
{"sdrangel.channel.demodatv", "ATVDemodSettings"},
|
||||
{"sdrangel.channel.demoddatv", "DATVDemodSettings"},
|
||||
{"sdrangel.channel.dsddemod", "DSDDemodSettings"},
|
||||
{"sdrangel.channeltx.filesrc", "FileSourceSettings"},
|
||||
{"sdrangel.channeltx.filesource", "FileSourceSettings"},
|
||||
{"sdrangel.channel.freedvdemod", "FreeDVDemodSettings"},
|
||||
{"sdrangel.channeltx.freedvmod", "FreeDVModSettings"},
|
||||
{"sdrangel.channel.freqtracker", "FreqTrackerSettings"},
|
||||
{"sdrangel.channel.nfmdemod", "NFMDemodSettings"},
|
||||
{"de.maintech.sdrangelove.channel.nfm", "NFMDemodSettings"}, // remap
|
||||
{"sdrangel.channeltx.nfmmod", "NFMModSettings"},
|
||||
{"sdrangel.channeltx.modnfm", "NFMModSettings"},
|
||||
{"sdrangel.demod.localsink", "LocalSinkSettings"},
|
||||
{"sdrangel.demod.localsource", "LocalSourceSettings"},
|
||||
{"sdrangel.channel.localsink", "LocalSinkSettings"}, // remap
|
||||
{"sdrangel.channel.localsource", "LocalSourceSettings"},
|
||||
{"sdrangel.demod.remotesink", "RemoteSinkSettings"},
|
||||
{"sdrangel.channeltx.remotesrc", "RemoteSourceSettings"},
|
||||
{"sdrangel.channeltx.ssbmod", "SSBModSettings"},
|
||||
{"sdrangel.channeltx.remotesource", "RemoteSourceSettings"},
|
||||
{"sdrangel.channeltx.modssb", "SSBModSettings"},
|
||||
{"sdrangel.channel.ssbdemod", "SSBDemodSettings"},
|
||||
{"de.maintech.sdrangelove.channel.ssb", "SSBDemodSettings"}, // remap
|
||||
{"sdrangel.channeltx.udpsink", "UDPSourceSettings"},
|
||||
{"sdrangel.demod.udpsrc", "UDPSinkSettings"},
|
||||
{"sdrangel.channeltx.udpsource", "UDPSourceSettings"},
|
||||
{"sdrangel.channeltx.udpsink", "UDPSourceSettings"}, // remap
|
||||
{"sdrangel.channel.udpsink", "UDPSinkSettings"},
|
||||
{"sdrangel.channel.udpsrc", "UDPSinkSettings"}, // remap
|
||||
{"sdrangel.channel.wfmdemod", "WFMDemodSettings"},
|
||||
{"de.maintech.sdrangelove.channel.wfm", "WFMDemodSettings"}, // remap
|
||||
{"sdrangel.channeltx.wfmmod", "WFMModSettings"}
|
||||
{"sdrangel.channeltx.modwfm", "WFMModSettings"}
|
||||
};
|
||||
|
||||
const QMap<QString, QString> WebAPIRequestMapper::m_deviceIdToSettingsKey = {
|
||||
@ -86,8 +90,10 @@ const QMap<QString, QString> WebAPIRequestMapper::m_deviceIdToSettingsKey = {
|
||||
{"sdrangel.samplesource.bladerf", "bladeRF1InputSettings"}, // remap
|
||||
{"sdrangel.samplesink.bladerf1output", "bladeRF1OutputSettings"},
|
||||
{"sdrangel.samplesource.bladerf1output", "bladeRF1OutputSettings"}, // remap
|
||||
{"sdrangel.samplesource.bladerfoutput", "bladeRF1OutputSettings"}, // remap
|
||||
{"sdrangel.samplesource.bladerf2input", "bladeRF2InputSettings"},
|
||||
{"sdrangel.samplesink.bladerf2output", "bladeRF2OutputSettings"},
|
||||
{"sdrangel.samplesource.bladerf2output", "bladeRF2OutputSettings"}, // remap
|
||||
{"sdrangel.samplesource.fcdpro", "fcdProSettings"},
|
||||
{"sdrangel.samplesource.fcdproplus", "fcdProPlusSettings"},
|
||||
{"sdrangel.samplesource.fileinput", "fileInputSettings"},
|
||||
@ -112,8 +118,8 @@ const QMap<QString, QString> WebAPIRequestMapper::m_deviceIdToSettingsKey = {
|
||||
{"sdrangel.samplesink.soapysdroutput", "soapySDROutputSettings"},
|
||||
{"sdrangel.samplesource.testsource", "testSourceSettings"},
|
||||
{"sdrangel.samplemimo.testmi", "testMISettings"},
|
||||
{"sdrangel.samplesource.xtrx", "xtrxInputSettings"},
|
||||
{"sdrangel.samplesink.xtrx", "xtrxOutputSettings"}
|
||||
{"sdrangel.samplesource.xtrx", "XtrxInputSettings"},
|
||||
{"sdrangel.samplesink.xtrx", "XtrxOutputSettings"}
|
||||
};
|
||||
|
||||
const QMap<QString, QString> WebAPIRequestMapper::m_channelTypeToSettingsKey = {
|
||||
@ -162,7 +168,7 @@ const QMap<QString, QString> WebAPIRequestMapper::m_sourceDeviceHwIdToSettingsKe
|
||||
{"SDRplay1", "sdrPlaySettings"},
|
||||
{"SoapySDR", "soapySDRInputSettings"},
|
||||
{"TestSource", "testSourceSettings"},
|
||||
{"XTRX", "xtrxInputSettings"}
|
||||
{"XTRX", "XtrxInputSettings"}
|
||||
};
|
||||
|
||||
const QMap<QString, QString> WebAPIRequestMapper::m_sinkDeviceHwIdToSettingsKey = {
|
||||
@ -174,7 +180,7 @@ const QMap<QString, QString> WebAPIRequestMapper::m_sinkDeviceHwIdToSettingsKey
|
||||
{"PlutoSDR", "plutoSdrOutputSettings"},
|
||||
{"RemoteOutput", "remoteOutputSettings"},
|
||||
{"SoapySDR", "soapySDROutputSettings"},
|
||||
{"XTRX", "xtrxOutputSettings"}
|
||||
{"XTRX", "XtrxOutputSettings"}
|
||||
};
|
||||
|
||||
const QMap<QString, QString> WebAPIRequestMapper::m_mimoDeviceHwIdToSettingsKey= {
|
||||
@ -2332,6 +2338,11 @@ bool WebAPIRequestMapper::appendPresetKeys(
|
||||
preset->setGroup(new QString(presetJson["group"].toString()));
|
||||
presetKeys.m_keys.append("group");
|
||||
}
|
||||
if (presetJson.contains("layout"))
|
||||
{
|
||||
preset->setLayout(new QString(presetJson["layout"].toString()));
|
||||
presetKeys.m_keys.append("layout");
|
||||
}
|
||||
|
||||
if (presetJson.contains("spectrumConfig"))
|
||||
{
|
||||
@ -2477,6 +2488,11 @@ bool WebAPIRequestMapper::getChannel(
|
||||
channelSettings->setDsdDemodSettings(new SWGSDRangel::SWGDSDDemodSettings());
|
||||
channelSettings->getDsdDemodSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (channelSettingsKey == "FileSourceSettings")
|
||||
{
|
||||
channelSettings->setFileSourceSettings(new SWGSDRangel::SWGFileSourceSettings());
|
||||
channelSettings->getFileSourceSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (channelSettingsKey == "FreeDVDemodSettings")
|
||||
{
|
||||
channelSettings->setFreeDvDemodSettings(new SWGSDRangel::SWGFreeDVDemodSettings());
|
||||
@ -2717,15 +2733,17 @@ bool WebAPIRequestMapper::getDevice(
|
||||
}
|
||||
else if (deviceSettingsKey == "soapySDRInputSettings")
|
||||
{
|
||||
deviceSettings->setSoapySdrInputSettings(new SWGSDRangel::SWGSoapySDRInputSettings());
|
||||
deviceSettings->getSoapySdrInputSettings()->init(); // contains complex objects
|
||||
deviceSettings->getSoapySdrInputSettings()->fromJsonObject(settingsJsonObject);
|
||||
processSoapySDRSettings(deviceSettings, settingsJsonObject, deviceSettingsKeys, true);
|
||||
// deviceSettings->setSoapySdrInputSettings(new SWGSDRangel::SWGSoapySDRInputSettings());
|
||||
// deviceSettings->getSoapySdrInputSettings()->init(); // contains complex objects
|
||||
// deviceSettings->getSoapySdrInputSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (deviceSettingsKey == "soapySDROutputSettings")
|
||||
{
|
||||
deviceSettings->setSoapySdrOutputSettings(new SWGSDRangel::SWGSoapySDROutputSettings());
|
||||
deviceSettings->getSoapySdrOutputSettings()->init(); // contains complex objects
|
||||
deviceSettings->getSoapySdrOutputSettings()->fromJsonObject(settingsJsonObject);
|
||||
processSoapySDRSettings(deviceSettings, settingsJsonObject, deviceSettingsKeys, false);
|
||||
// deviceSettings->setSoapySdrOutputSettings(new SWGSDRangel::SWGSoapySDROutputSettings());
|
||||
// deviceSettings->getSoapySdrOutputSettings()->init(); // contains complex objects
|
||||
// deviceSettings->getSoapySdrOutputSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (deviceSettingsKey == "testSourceSettings")
|
||||
{
|
||||
@ -2741,12 +2759,12 @@ bool WebAPIRequestMapper::getDevice(
|
||||
deviceSettings->setTestMiSettings(new SWGSDRangel::SWGTestMISettings());
|
||||
deviceSettings->getTestMiSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (deviceSettingsKey == "xtrxInputSettings")
|
||||
else if (deviceSettingsKey == "XtrxInputSettings")
|
||||
{
|
||||
deviceSettings->setXtrxInputSettings(new SWGSDRangel::SWGXtrxInputSettings());
|
||||
deviceSettings->getXtrxInputSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (deviceSettingsKey == "xtrxOutputSettings")
|
||||
else if (deviceSettingsKey == "XtrxOutputSettings")
|
||||
{
|
||||
deviceSettings->setXtrxOutputSettings(new SWGSDRangel::SWGXtrxOutputSettings());
|
||||
deviceSettings->getXtrxOutputSettings()->fromJsonObject(settingsJsonObject);
|
||||
@ -2808,7 +2826,7 @@ void WebAPIRequestMapper::appendSettingsArrayKeys(
|
||||
|
||||
for (int arrayIndex = 0; arrayIndex < arrayJson.count(); arrayIndex++)
|
||||
{
|
||||
QJsonValue v = arrayJson.takeAt(arrayIndex);
|
||||
QJsonValue v = arrayJson.at(arrayIndex);
|
||||
|
||||
if (v.isObject())
|
||||
{
|
||||
@ -2942,6 +2960,9 @@ void WebAPIRequestMapper::processChannelAnalyzerSettings(
|
||||
if (channelSettingsJson.contains("fll")) {
|
||||
channelAnalyzerSettings->setFll(channelSettingsJson["fll"].toInt());
|
||||
}
|
||||
if (channelSettingsJson.contains("frequency")) {
|
||||
channelAnalyzerSettings->setFrequency(channelSettingsJson["frequency"].toInt());
|
||||
}
|
||||
if (channelSettingsJson.contains("inputType")) {
|
||||
channelAnalyzerSettings->setInputType(channelSettingsJson["inputType"].toInt());
|
||||
}
|
||||
@ -2966,6 +2987,12 @@ void WebAPIRequestMapper::processChannelAnalyzerSettings(
|
||||
if (channelSettingsJson.contains("spanLog2")) {
|
||||
channelAnalyzerSettings->setSpanLog2(channelSettingsJson["spanLog2"].toInt());
|
||||
}
|
||||
if (channelSettingsJson.contains("ssb")) {
|
||||
channelAnalyzerSettings->setSsb(channelSettingsJson["ssb"].toInt());
|
||||
}
|
||||
if (channelSettingsJson.contains("title")) {
|
||||
channelAnalyzerSettings->setTitle(new QString(channelSettingsJson["title"].toString()));
|
||||
}
|
||||
|
||||
if (channelSettingsJson.contains("spectrumConfig"))
|
||||
{
|
||||
@ -3030,4 +3057,275 @@ void WebAPIRequestMapper::processChannelAnalyzerSettings(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::processSoapySDRSettings(
|
||||
SWGSDRangel::SWGDeviceSettings *deviceSettings,
|
||||
QJsonObject& deviceSettingsJson,
|
||||
QStringList& deviceSettingsKeys,
|
||||
bool inputElseOutput
|
||||
)
|
||||
{
|
||||
if (inputElseOutput)
|
||||
{
|
||||
SWGSDRangel::SWGSoapySDRInputSettings *swgSoapySDRInputSettings = new SWGSDRangel::SWGSoapySDRInputSettings();
|
||||
deviceSettings->setSoapySdrInputSettings(swgSoapySDRInputSettings);
|
||||
swgSoapySDRInputSettings->init();
|
||||
|
||||
if (deviceSettingsJson.contains("centerFrequency")) {
|
||||
swgSoapySDRInputSettings->setCenterFrequency(deviceSettingsJson["centerFrequency"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("LOppmTenths")) {
|
||||
swgSoapySDRInputSettings->setLOppmTenths(deviceSettingsJson["LOppmTenths"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("devSampleRate")) {
|
||||
swgSoapySDRInputSettings->setDevSampleRate(deviceSettingsJson["devSampleRate"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("log2Decim")) {
|
||||
swgSoapySDRInputSettings->setLog2Decim(deviceSettingsJson["log2Decim"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("fcPos")) {
|
||||
swgSoapySDRInputSettings->setFcPos(deviceSettingsJson["fcPos"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("softDCCorrection")) {
|
||||
swgSoapySDRInputSettings->setSoftDcCorrection(deviceSettingsJson["softDCCorrection"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("softIQCorrection")) {
|
||||
swgSoapySDRInputSettings->setSoftIqCorrection(deviceSettingsJson["softIQCorrection"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("transverterMode")) {
|
||||
swgSoapySDRInputSettings->setTransverterMode(deviceSettingsJson["transverterMode"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("transverterDeltaFrequency")) {
|
||||
swgSoapySDRInputSettings->setTransverterDeltaFrequency(deviceSettingsJson["transverterDeltaFrequency"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("fileRecordName")) {
|
||||
swgSoapySDRInputSettings->setFileRecordName(new QString(deviceSettingsJson["fileRecordName"].toString()));
|
||||
}
|
||||
if (deviceSettingsJson.contains("antenna")) {
|
||||
swgSoapySDRInputSettings->setAntenna(new QString(deviceSettingsJson["antenna"].toString()));
|
||||
}
|
||||
if (deviceSettingsJson.contains("bandwidth")) {
|
||||
swgSoapySDRInputSettings->setBandwidth(deviceSettingsJson["bandwidth"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("globalGain")) {
|
||||
swgSoapySDRInputSettings->setGlobalGain(deviceSettingsJson["globalGain"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("autoGain")) {
|
||||
swgSoapySDRInputSettings->setAutoGain(deviceSettingsJson["autoGain"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("autoDCCorrection")) {
|
||||
swgSoapySDRInputSettings->setAutoDcCorrection(deviceSettingsJson["autoDCCorrection"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("autoIQCorrection")) {
|
||||
swgSoapySDRInputSettings->setAutoIqCorrection(deviceSettingsJson["autoIQCorrection"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("dcCorrection"))
|
||||
{
|
||||
SWGSDRangel::SWGComplex *swgComplex = new SWGSDRangel::SWGComplex;
|
||||
swgSoapySDRInputSettings->setDcCorrection(swgComplex);
|
||||
QJsonObject complexJson = deviceSettingsJson["dcCorrection"].toObject();
|
||||
|
||||
if (complexJson.contains("real")) {
|
||||
swgComplex->setReal(complexJson["real"].toDouble());
|
||||
}
|
||||
if (complexJson.contains("imag")) {
|
||||
swgComplex->setImag(complexJson["imag"].toDouble());
|
||||
}
|
||||
}
|
||||
if (deviceSettingsJson.contains("iqCorrection"))
|
||||
{
|
||||
SWGSDRangel::SWGComplex *swgComplex = new SWGSDRangel::SWGComplex;
|
||||
swgSoapySDRInputSettings->setIqCorrection(swgComplex);
|
||||
QJsonObject complexJson = deviceSettingsJson["iqCorrection"].toObject();
|
||||
|
||||
if (complexJson.contains("real")) {
|
||||
swgComplex->setReal(complexJson["real"].toDouble());
|
||||
}
|
||||
if (complexJson.contains("imag")) {
|
||||
swgComplex->setImag(complexJson["imag"].toDouble());
|
||||
}
|
||||
}
|
||||
if (deviceSettingsJson.contains("useReverseAPI")) {
|
||||
swgSoapySDRInputSettings->setUseReverseApi(deviceSettingsJson["useReverseAPI"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("reverseAPIAddress")) {
|
||||
swgSoapySDRInputSettings->setReverseApiAddress(new QString(deviceSettingsJson["reverseAPIAddress"].toString()));
|
||||
}
|
||||
if (deviceSettingsJson.contains("reverseAPIPort")) {
|
||||
swgSoapySDRInputSettings->setReverseApiPort(deviceSettingsJson["reverseAPIPort"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("reverseAPIDeviceIndex")) {
|
||||
swgSoapySDRInputSettings->setReverseApiDeviceIndex(deviceSettingsJson["reverseAPIDeviceIndex"].toInt());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SWGSDRangel::SWGSoapySDROutputSettings *swgSoapySDROutputSettings = new SWGSDRangel::SWGSoapySDROutputSettings();
|
||||
deviceSettings->setSoapySdrOutputSettings(swgSoapySDROutputSettings);
|
||||
swgSoapySDROutputSettings->init();
|
||||
|
||||
if (deviceSettingsJson.contains("centerFrequency")) {
|
||||
swgSoapySDROutputSettings->setCenterFrequency(deviceSettingsJson["centerFrequency"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("LOppmTenths")) {
|
||||
swgSoapySDROutputSettings->setLOppmTenths(deviceSettingsJson["LOppmTenths"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("devSampleRate")) {
|
||||
swgSoapySDROutputSettings->setDevSampleRate(deviceSettingsJson["devSampleRate"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("log2Interp")) {
|
||||
swgSoapySDROutputSettings->setLog2Interp(deviceSettingsJson["log2Interp"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("transverterMode")) {
|
||||
swgSoapySDROutputSettings->setTransverterMode(deviceSettingsJson["transverterMode"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("transverterDeltaFrequency")) {
|
||||
swgSoapySDROutputSettings->setTransverterDeltaFrequency(deviceSettingsJson["transverterDeltaFrequency"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("antenna")) {
|
||||
swgSoapySDROutputSettings->setAntenna(new QString(deviceSettingsJson["antenna"].toString()));
|
||||
}
|
||||
if (deviceSettingsJson.contains("bandwidth")) {
|
||||
swgSoapySDROutputSettings->setBandwidth(deviceSettingsJson["bandwidth"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("globalGain")) {
|
||||
swgSoapySDROutputSettings->setGlobalGain(deviceSettingsJson["globalGain"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("autoGain")) {
|
||||
swgSoapySDROutputSettings->setAutoGain(deviceSettingsJson["autoGain"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("autoDCCorrection")) {
|
||||
swgSoapySDROutputSettings->setAutoDcCorrection(deviceSettingsJson["autoDCCorrection"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("autoIQCorrection")) {
|
||||
swgSoapySDROutputSettings->setAutoIqCorrection(deviceSettingsJson["autoIQCorrection"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("dcCorrection"))
|
||||
{
|
||||
SWGSDRangel::SWGComplex *swgComplex = new SWGSDRangel::SWGComplex;
|
||||
swgSoapySDROutputSettings->setDcCorrection(swgComplex);
|
||||
QJsonObject complexJson = deviceSettingsJson["dcCorrection"].toObject();
|
||||
|
||||
if (complexJson.contains("real")) {
|
||||
swgComplex->setReal(complexJson["real"].toDouble());
|
||||
}
|
||||
if (complexJson.contains("imag")) {
|
||||
swgComplex->setImag(complexJson["imag"].toDouble());
|
||||
}
|
||||
}
|
||||
if (deviceSettingsJson.contains("iqCorrection"))
|
||||
{
|
||||
SWGSDRangel::SWGComplex *swgComplex = new SWGSDRangel::SWGComplex;
|
||||
swgSoapySDROutputSettings->setIqCorrection(swgComplex);
|
||||
QJsonObject complexJson = deviceSettingsJson["iqCorrection"].toObject();
|
||||
|
||||
if (complexJson.contains("real")) {
|
||||
swgComplex->setReal(complexJson["real"].toDouble());
|
||||
}
|
||||
if (complexJson.contains("imag")) {
|
||||
swgComplex->setImag(complexJson["imag"].toDouble());
|
||||
}
|
||||
}
|
||||
if (deviceSettingsJson.contains("useReverseAPI")) {
|
||||
swgSoapySDROutputSettings->setUseReverseApi(deviceSettingsJson["useReverseAPI"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("reverseAPIAddress")) {
|
||||
swgSoapySDROutputSettings->setReverseApiAddress(new QString(deviceSettingsJson["reverseAPIAddress"].toString()));
|
||||
}
|
||||
if (deviceSettingsJson.contains("reverseAPIPort")) {
|
||||
swgSoapySDROutputSettings->setReverseApiPort(deviceSettingsJson["reverseAPIPort"].toInt());
|
||||
}
|
||||
if (deviceSettingsJson.contains("reverseAPIDeviceIndex")) {
|
||||
swgSoapySDROutputSettings->setReverseApiDeviceIndex(deviceSettingsJson["reverseAPIDeviceIndex"].toInt());
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceSettingsKeys.contains("deviceArgSettings"))
|
||||
{
|
||||
QList<SWGSDRangel::SWGArgValue *> *swgArgSettings = new QList<SWGSDRangel::SWGArgValue *>;
|
||||
QJsonArray argsJson = deviceSettingsJson["deviceArgSettings"].toArray();
|
||||
|
||||
if (inputElseOutput) {
|
||||
deviceSettings->getSoapySdrInputSettings()->setDeviceArgSettings(swgArgSettings);
|
||||
} else {
|
||||
deviceSettings->getSoapySdrOutputSettings()->setDeviceArgSettings(swgArgSettings);
|
||||
}
|
||||
|
||||
for (int i = 0; i < argsJson.count(); i++)
|
||||
{
|
||||
SWGSDRangel::SWGArgValue *argValue = new SWGSDRangel::SWGArgValue();
|
||||
swgArgSettings->append(argValue);
|
||||
QJsonObject argValueJson = argsJson.at(i).toObject();
|
||||
argValue->fromJsonObject(argValueJson);
|
||||
}
|
||||
|
||||
appendSettingsArrayKeys(deviceSettingsJson, "deviceArgSettings", deviceSettingsKeys);
|
||||
}
|
||||
|
||||
if (deviceSettingsKeys.contains("individualGains"))
|
||||
{
|
||||
QList<SWGSDRangel::SWGArgValue *> *swgIndividualGains = new QList<SWGSDRangel::SWGArgValue *>;
|
||||
QJsonArray argsJson = deviceSettingsJson["individualGains"].toArray();
|
||||
|
||||
if (inputElseOutput) {
|
||||
deviceSettings->getSoapySdrInputSettings()->setIndividualGains(swgIndividualGains);
|
||||
} else {
|
||||
deviceSettings->getSoapySdrOutputSettings()->setIndividualGains(swgIndividualGains);
|
||||
}
|
||||
|
||||
for (int i = 0; i < argsJson.count(); i++)
|
||||
{
|
||||
SWGSDRangel::SWGArgValue *argValue = new SWGSDRangel::SWGArgValue();
|
||||
swgIndividualGains->append(argValue);
|
||||
QJsonObject argValueJson = argsJson.at(i).toObject();
|
||||
argValue->fromJsonObject(argValueJson);
|
||||
}
|
||||
|
||||
appendSettingsArrayKeys(deviceSettingsJson, "individualGains", deviceSettingsKeys);
|
||||
}
|
||||
|
||||
if (deviceSettingsKeys.contains("streamArgSettings"))
|
||||
{
|
||||
QList<SWGSDRangel::SWGArgValue *> *swgStreamArgSettings = new QList<SWGSDRangel::SWGArgValue *>;
|
||||
QJsonArray argsJson = deviceSettingsJson["streamArgSettings"].toArray();
|
||||
|
||||
if (inputElseOutput) {
|
||||
deviceSettings->getSoapySdrInputSettings()->setStreamArgSettings(swgStreamArgSettings);
|
||||
} else {
|
||||
deviceSettings->getSoapySdrOutputSettings()->setStreamArgSettings(swgStreamArgSettings);
|
||||
}
|
||||
|
||||
for (int i = 0; i < argsJson.count(); i++)
|
||||
{
|
||||
SWGSDRangel::SWGArgValue *argValue = new SWGSDRangel::SWGArgValue();
|
||||
swgStreamArgSettings->append(argValue);
|
||||
QJsonObject argValueJson = argsJson.at(i).toObject();
|
||||
argValue->fromJsonObject(argValueJson);
|
||||
}
|
||||
|
||||
appendSettingsArrayKeys(deviceSettingsJson, "streamArgSettings", deviceSettingsKeys);
|
||||
}
|
||||
|
||||
if (deviceSettingsKeys.contains("tunableElements"))
|
||||
{
|
||||
QList<SWGSDRangel::SWGArgValue *> *swgTunableElements = new QList<SWGSDRangel::SWGArgValue *>;
|
||||
QJsonArray argsJson = deviceSettingsJson["tunableElements"].toArray();
|
||||
|
||||
if (inputElseOutput) {
|
||||
deviceSettings->getSoapySdrInputSettings()->setTunableElements(swgTunableElements);
|
||||
} else {
|
||||
deviceSettings->getSoapySdrOutputSettings()->setTunableElements(swgTunableElements);
|
||||
}
|
||||
|
||||
for (int i = 0; i < argsJson.count(); i++)
|
||||
{
|
||||
SWGSDRangel::SWGArgValue *argValue = new SWGSDRangel::SWGArgValue();
|
||||
swgTunableElements->append(argValue);
|
||||
QJsonObject argValueJson = argsJson.at(i).toObject();
|
||||
argValue->fromJsonObject(argValueJson);
|
||||
}
|
||||
|
||||
appendSettingsArrayKeys(deviceSettingsJson, "tunableElements", deviceSettingsKeys);
|
||||
}
|
||||
}
|
@ -151,6 +151,13 @@ private:
|
||||
QStringList& channelSettingsKeys
|
||||
);
|
||||
|
||||
void processSoapySDRSettings(
|
||||
SWGSDRangel::SWGDeviceSettings *deviceSettings,
|
||||
QJsonObject& deviceSettingsJson,
|
||||
QStringList& deviceSettingsKeys,
|
||||
bool inputElseOutput
|
||||
);
|
||||
|
||||
static const QMap<QString, QString> m_channelURIToSettingsKey;
|
||||
static const QMap<QString, QString> m_deviceIdToSettingsKey;
|
||||
static const QMap<QString, QString> m_channelTypeToSettingsKey;
|
||||
|
@ -160,9 +160,6 @@ int WebAPIAdapterGUI::instanceConfigPutPatch(
|
||||
{
|
||||
WebAPIAdapterBase webAPIAdapterBase;
|
||||
webAPIAdapterBase.setPluginManager(m_mainWindow.getPluginManager());
|
||||
// qDebug("WebAPIAdapterGUI::instanceConfigPutPatch: configKeys:");
|
||||
// configKeys.debug();
|
||||
// return 200;
|
||||
|
||||
if (force) {
|
||||
webAPIAdapterBase.webapiInitConfig(m_mainWindow.m_settings);
|
||||
|
@ -44,6 +44,7 @@ MESSAGE_CLASS_DEFINITION(MainCore::MsgRemoveLastDeviceSet, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgSetDevice, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgAddChannel, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteChannel, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainCore::MsgApplySettings, Message)
|
||||
|
||||
MainCore *MainCore::m_instance = 0;
|
||||
|
||||
@ -179,6 +180,11 @@ bool MainCore::handleMessage(const Message& cmd)
|
||||
deleteChannel(notif.getDeviceSetIndex(), notif.getChannelIndex());
|
||||
return true;
|
||||
}
|
||||
else if (MsgApplySettings::match(cmd))
|
||||
{
|
||||
applySettings();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -206,6 +212,12 @@ void MainCore::loadSettings()
|
||||
setLoggingOptions();
|
||||
}
|
||||
|
||||
void MainCore::applySettings()
|
||||
{
|
||||
m_settings.sortPresets();
|
||||
setLoggingOptions();
|
||||
}
|
||||
|
||||
void MainCore::setLoggingOptions()
|
||||
{
|
||||
m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel());
|
||||
|
@ -270,6 +270,20 @@ private:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgApplySettings : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
static MsgApplySettings* create() {
|
||||
return new MsgApplySettings();
|
||||
}
|
||||
|
||||
private:
|
||||
MsgApplySettings() :
|
||||
Message()
|
||||
{ }
|
||||
};
|
||||
|
||||
static MainCore *m_instance;
|
||||
MainSettings m_settings;
|
||||
int m_masterTabIndex;
|
||||
@ -287,6 +301,7 @@ private:
|
||||
WebAPIAdapterSrv *m_apiAdapter;
|
||||
|
||||
void loadSettings();
|
||||
void applySettings();
|
||||
void loadPresetSettings(const Preset* preset, int tabIndex);
|
||||
void savePresetSettings(Preset* preset, int tabIndex);
|
||||
void setLoggingOptions();
|
||||
|
@ -164,7 +164,36 @@ int WebAPIAdapterSrv::instanceConfigPutPatch(
|
||||
webAPIAdapterBase.webapiInitConfig(m_mainCore.m_settings);
|
||||
}
|
||||
|
||||
// TODO
|
||||
Preferences newPreferences = m_mainCore.m_settings.getPreferences();
|
||||
webAPIAdapterBase.webapiUpdatePreferences(query.getPreferences(), configKeys.m_preferencesKeys, newPreferences);
|
||||
m_mainCore.m_settings.setPreferences(newPreferences);
|
||||
|
||||
Preset *workingPreset = m_mainCore.m_settings.getWorkingPreset();
|
||||
webAPIAdapterBase.webapiUpdatePreset(force, query.getWorkingPreset(), configKeys.m_workingPresetKeys, workingPreset);
|
||||
|
||||
QList<PresetKeys>::const_iterator presetKeysIt = configKeys.m_presetKeys.begin();
|
||||
int i = 0;
|
||||
for (; presetKeysIt != configKeys.m_presetKeys.end(); ++presetKeysIt, i++)
|
||||
{
|
||||
Preset *newPreset = new Preset(); // created with default values
|
||||
SWGSDRangel::SWGPreset *swgPreset = query.getPresets()->at(i);
|
||||
webAPIAdapterBase.webapiUpdatePreset(force, swgPreset, *presetKeysIt, newPreset);
|
||||
m_mainCore.m_settings.addPreset(newPreset);
|
||||
}
|
||||
|
||||
QList<CommandKeys>::const_iterator commandKeysIt = configKeys.m_commandKeys.begin();
|
||||
i = 0;
|
||||
for (; commandKeysIt != configKeys.m_commandKeys.end(); ++commandKeysIt, i++)
|
||||
{
|
||||
Command *newCommand = new Command(); // created with default values
|
||||
SWGSDRangel::SWGCommand *swgCommand = query.getCommands()->at(i);
|
||||
webAPIAdapterBase.webapiUpdateCommand(swgCommand, *commandKeysIt, *newCommand);
|
||||
m_mainCore.m_settings.addCommand(newCommand);
|
||||
}
|
||||
|
||||
MainCore::MsgApplySettings *msg = MainCore::MsgApplySettings::create();
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user