mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-21 10:59:12 -04:00
REST API: config: GET (12): added spectrum settings data
This commit is contained in:
parent
4b3d088407
commit
e06b7fce90
@ -19,6 +19,11 @@
|
||||
#include "util/simpleserializer.h"
|
||||
#include "glspectrumsettings.h"
|
||||
|
||||
GLSpectrumSettings::GLSpectrumSettings()
|
||||
{
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
void GLSpectrumSettings::resetToDefaults()
|
||||
{
|
||||
m_fftSize = 1024;
|
||||
|
@ -3099,7 +3099,7 @@ margin-bottom: 20px;
|
||||
"fftOverlap" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"m_fftWindow" : {
|
||||
"fftWindow" : {
|
||||
"type" : "integer",
|
||||
"description" : "See FFTWindow"
|
||||
},
|
||||
@ -26955,7 +26955,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2019-08-04T02:40:24.306+02:00
|
||||
Generated 2019-08-05T03:02:48.921+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@ GLSpectrum:
|
||||
type: integer
|
||||
fftOverlap:
|
||||
type: integer
|
||||
m_fftWindow:
|
||||
fftWindow:
|
||||
description: See FFTWindow
|
||||
type: integer
|
||||
refLevel:
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "channel/channelutils.h"
|
||||
#include "device/devicewebapiadapter.h"
|
||||
#include "device/deviceutils.h"
|
||||
#include "dsp/glspectrumsettings.h"
|
||||
#include "webapiadapterbase.h"
|
||||
|
||||
WebAPIAdapterBase::WebAPIAdapterBase()
|
||||
@ -60,9 +61,37 @@ void WebAPIAdapterBase::webapiFormatPreset(
|
||||
apiPreset->setGroup(new QString(preset.getGroup()));
|
||||
apiPreset->setDescription(new QString(preset.getDescription()));
|
||||
apiPreset->setCenterFrequency(preset.getCenterFrequency());
|
||||
apiPreset->getSpectrumConfig()->init(); // TODO when spectrum config is extracted to sdrbase
|
||||
apiPreset->setDcOffsetCorrection(preset.hasDCOffsetCorrection() ? 1 : 0);
|
||||
apiPreset->setIqImbalanceCorrection(preset.hasIQImbalanceCorrection() ? 1 : 0);
|
||||
const QByteArray& spectrumConfig = preset.getSpectrumConfig();
|
||||
GLSpectrumSettings m_spectrumSettings;
|
||||
|
||||
if (m_spectrumSettings.deserialize(spectrumConfig))
|
||||
{
|
||||
SWGSDRangel::SWGGLSpectrum *swgSpectrumConfig = apiPreset->getSpectrumConfig();
|
||||
swgSpectrumConfig->init();
|
||||
swgSpectrumConfig->setFftSize(m_spectrumSettings.m_fftSize);
|
||||
swgSpectrumConfig->setFftOverlap(m_spectrumSettings.m_fftOverlap);
|
||||
swgSpectrumConfig->setFftWindow((int) m_spectrumSettings.m_fftWindow);
|
||||
swgSpectrumConfig->setRefLevel(m_spectrumSettings.m_refLevel);
|
||||
swgSpectrumConfig->setPowerRange(m_spectrumSettings.m_powerRange);
|
||||
swgSpectrumConfig->setDisplayWaterfall(m_spectrumSettings.m_displayWaterfall ? 0 : 1);
|
||||
swgSpectrumConfig->setInvertedWaterfall(m_spectrumSettings.m_invertedWaterfall ? 0 : 1);
|
||||
swgSpectrumConfig->setDisplayMaxHold(m_spectrumSettings.m_displayMaxHold ? 0 : 1);
|
||||
swgSpectrumConfig->setDisplayHistogram(m_spectrumSettings.m_displayHistogram ? 0 : 1);
|
||||
swgSpectrumConfig->setDecay(m_spectrumSettings.m_decay);
|
||||
swgSpectrumConfig->setDisplayGrid(m_spectrumSettings.m_displayGrid ? 1 : 0);
|
||||
swgSpectrumConfig->setInvert(m_spectrumSettings.m_invert ? 1 : 0);
|
||||
swgSpectrumConfig->setDisplayGridIntensity(m_spectrumSettings.m_displayGridIntensity);
|
||||
swgSpectrumConfig->setDecayDivisor(m_spectrumSettings.m_decayDivisor);
|
||||
swgSpectrumConfig->setHistogramStroke(m_spectrumSettings.m_histogramStroke);
|
||||
swgSpectrumConfig->setDisplayCurrent(m_spectrumSettings.m_displayCurrent ? 1 : 0);
|
||||
swgSpectrumConfig->setDisplayTraceIntensity(m_spectrumSettings.m_displayTraceIntensity);
|
||||
swgSpectrumConfig->setWaterfallShare(m_spectrumSettings.m_waterfallShare);
|
||||
swgSpectrumConfig->setAveragingMode((int) m_spectrumSettings.m_averagingMode);
|
||||
swgSpectrumConfig->setAveragingValue(GLSpectrumSettings::getAveragingValue(m_spectrumSettings.m_averagingIndex, m_spectrumSettings.m_averagingMode));
|
||||
swgSpectrumConfig->setLinear(m_spectrumSettings.m_linear ? 1 : 0);
|
||||
}
|
||||
|
||||
int nbChannels = preset.getChannelCount();
|
||||
for (int i = 0; i < nbChannels; i++)
|
||||
|
@ -5,7 +5,7 @@ GLSpectrum:
|
||||
type: integer
|
||||
fftOverlap:
|
||||
type: integer
|
||||
m_fftWindow:
|
||||
fftWindow:
|
||||
description: See FFTWindow
|
||||
type: integer
|
||||
refLevel:
|
||||
|
@ -3099,7 +3099,7 @@ margin-bottom: 20px;
|
||||
"fftOverlap" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"m_fftWindow" : {
|
||||
"fftWindow" : {
|
||||
"type" : "integer",
|
||||
"description" : "See FFTWindow"
|
||||
},
|
||||
@ -26955,7 +26955,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2019-08-04T02:40:24.306+02:00
|
||||
Generated 2019-08-05T03:02:48.921+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -32,8 +32,8 @@ SWGGLSpectrum::SWGGLSpectrum() {
|
||||
m_fft_size_isSet = false;
|
||||
fft_overlap = 0;
|
||||
m_fft_overlap_isSet = false;
|
||||
m_fft_window = 0;
|
||||
m_m_fft_window_isSet = false;
|
||||
fft_window = 0;
|
||||
m_fft_window_isSet = false;
|
||||
ref_level = 0.0f;
|
||||
m_ref_level_isSet = false;
|
||||
power_range = 0.0f;
|
||||
@ -82,8 +82,8 @@ SWGGLSpectrum::init() {
|
||||
m_fft_size_isSet = false;
|
||||
fft_overlap = 0;
|
||||
m_fft_overlap_isSet = false;
|
||||
m_fft_window = 0;
|
||||
m_m_fft_window_isSet = false;
|
||||
fft_window = 0;
|
||||
m_fft_window_isSet = false;
|
||||
ref_level = 0.0f;
|
||||
m_ref_level_isSet = false;
|
||||
power_range = 0.0f;
|
||||
@ -162,7 +162,7 @@ SWGGLSpectrum::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&fft_overlap, pJson["fftOverlap"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&m_fft_window, pJson["m_fftWindow"], "qint32", "");
|
||||
::SWGSDRangel::setValue(&fft_window, pJson["fftWindow"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&ref_level, pJson["refLevel"], "float", "");
|
||||
|
||||
@ -222,8 +222,8 @@ SWGGLSpectrum::asJsonObject() {
|
||||
if(m_fft_overlap_isSet){
|
||||
obj->insert("fftOverlap", QJsonValue(fft_overlap));
|
||||
}
|
||||
if(m_m_fft_window_isSet){
|
||||
obj->insert("m_fftWindow", QJsonValue(m_fft_window));
|
||||
if(m_fft_window_isSet){
|
||||
obj->insert("fftWindow", QJsonValue(fft_window));
|
||||
}
|
||||
if(m_ref_level_isSet){
|
||||
obj->insert("refLevel", QJsonValue(ref_level));
|
||||
@ -304,13 +304,13 @@ SWGGLSpectrum::setFftOverlap(qint32 fft_overlap) {
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGGLSpectrum::getMFftWindow() {
|
||||
return m_fft_window;
|
||||
SWGGLSpectrum::getFftWindow() {
|
||||
return fft_window;
|
||||
}
|
||||
void
|
||||
SWGGLSpectrum::setMFftWindow(qint32 m_fft_window) {
|
||||
this->m_fft_window = m_fft_window;
|
||||
this->m_m_fft_window_isSet = true;
|
||||
SWGGLSpectrum::setFftWindow(qint32 fft_window) {
|
||||
this->fft_window = fft_window;
|
||||
this->m_fft_window_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
@ -504,7 +504,7 @@ SWGGLSpectrum::isSet(){
|
||||
if(m_fft_overlap_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_m_fft_window_isSet){
|
||||
if(m_fft_window_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_ref_level_isSet){
|
||||
|
@ -47,8 +47,8 @@ public:
|
||||
qint32 getFftOverlap();
|
||||
void setFftOverlap(qint32 fft_overlap);
|
||||
|
||||
qint32 getMFftWindow();
|
||||
void setMFftWindow(qint32 m_fft_window);
|
||||
qint32 getFftWindow();
|
||||
void setFftWindow(qint32 fft_window);
|
||||
|
||||
float getRefLevel();
|
||||
void setRefLevel(float ref_level);
|
||||
@ -114,8 +114,8 @@ private:
|
||||
qint32 fft_overlap;
|
||||
bool m_fft_overlap_isSet;
|
||||
|
||||
qint32 m_fft_window;
|
||||
bool m_m_fft_window_isSet;
|
||||
qint32 fft_window;
|
||||
bool m_fft_window_isSet;
|
||||
|
||||
float ref_level;
|
||||
bool m_ref_level_isSet;
|
||||
|
Loading…
Reference in New Issue
Block a user