mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-11-19 22:53:47 -05:00
Interferometer (1)
This commit is contained in:
parent
3b9c22b77d
commit
3e70f3b966
79
plugins/channelmimo/interferometer/interferometer.cpp
Normal file
79
plugins/channelmimo/interferometer/interferometer.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/deviceapi.h"
|
||||
#include "dsp/downchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
|
||||
#include "interferometer.h"
|
||||
|
||||
const QString Interferometer::m_channelIdURI = "sdrangel.channel.interferometer";
|
||||
const QString Interferometer::m_channelId = "Interferometer";
|
||||
|
||||
Interferometer::Interferometer(DeviceAPI *deviceAPI) :
|
||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_correlator(4096),
|
||||
m_spectrumSink(nullptr),
|
||||
m_scopeSink(nullptr)
|
||||
{
|
||||
m_correlator.setCorrIndex(1);
|
||||
connect(&m_correlator, SIGNAL(dataReady(int, int)), this, SLOT(handleData(int, int)));
|
||||
|
||||
for (int i = 0; i < m_deviceAPI->getNbSourceStreams(); i++)
|
||||
{
|
||||
m_sinks.push_back(InterferometerSink(&m_correlator));
|
||||
m_channelizers.push_back(new DownChannelizer(&m_sinks.back()));
|
||||
m_threadedBasebandSampleSinks.push_back(new ThreadedBasebandSampleSink(m_channelizers.back(), &m_sinks.back()));
|
||||
m_deviceAPI->addChannelSink(m_threadedBasebandSampleSinks.back(), i);
|
||||
|
||||
if (i == 2) { // 2 way interferometer
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_deviceAPI->addChannelSinkAPI(this);
|
||||
m_sinks.back().setProcessingUnit(true); // The last one is processed last by the engine
|
||||
}
|
||||
|
||||
Interferometer::~Interferometer()
|
||||
{
|
||||
while (!m_threadedBasebandSampleSinks.empty())
|
||||
{
|
||||
m_deviceAPI->removeChannelSink(m_threadedBasebandSampleSinks.back());
|
||||
delete m_threadedBasebandSampleSinks.back();
|
||||
m_threadedBasebandSampleSinks.pop_back();
|
||||
}
|
||||
|
||||
while (!m_channelizers.empty())
|
||||
{
|
||||
delete m_channelizers.back();
|
||||
m_channelizers.pop_back();
|
||||
}
|
||||
|
||||
m_deviceAPI->removeChannelSinkAPI(this);
|
||||
}
|
||||
|
||||
void Interferometer::handleData(int start, int stop)
|
||||
{
|
||||
if ((m_settings.m_correlationType == InterferometerSettings::CorrelationAdd)
|
||||
|| (m_settings.m_correlationType == InterferometerSettings::CorrelationMultiply))
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
56
plugins/channelmimo/interferometer/interferometer.h
Normal file
56
plugins/channelmimo/interferometer/interferometer.h
Normal file
@ -0,0 +1,56 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INTERFEROMETER_H
|
||||
#define INCLUDE_INTERFEROMETER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "channel/channelapi.h"
|
||||
#include "interferometersink.h"
|
||||
#include "interferometercorr.h"
|
||||
|
||||
class DeviceAPI;
|
||||
class DownChannelizer;
|
||||
class ThreadedBasebandSampleSink;
|
||||
|
||||
class Interferometer: public QObject, ChannelAPI
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Interferometer(DeviceAPI *deviceAPI);
|
||||
virtual ~Interferometer();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
static const QString m_channelIdURI;
|
||||
static const QString m_channelId;
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
InterferometerCorrelator m_correlator;
|
||||
std::vector<InterferometerSink> m_sinks;
|
||||
std::vector<DownChannelizer*> m_channelizers;
|
||||
std::vector<ThreadedBasebandSampleSink*> m_threadedBasebandSampleSinks;
|
||||
BasebandSampleSink* m_spectrumSink;
|
||||
BasebandSampleSink* m_scopeSink;
|
||||
InterferometerSettings m_settings;
|
||||
|
||||
private slots:
|
||||
void handleData(int start, int stop);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_INTERFEROMETER_H
|
||||
210
plugins/channelmimo/interferometer/interferometercorr.cpp
Normal file
210
plugins/channelmimo/interferometer/interferometercorr.cpp
Normal file
@ -0,0 +1,210 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "dsp/fftengine.h"
|
||||
#include "interferometercorr.h"
|
||||
|
||||
std::complex<float> fcAdd(std::complex<float>& a, const std::complex<float>& b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
std::complex<float> fcMul(std::complex<float>& a, const std::complex<float>& b) {
|
||||
return a * b;
|
||||
}
|
||||
|
||||
Sample cf2sAdd(std::complex<float>& a, const std::complex<float>& b)
|
||||
{
|
||||
std::complex<float> c = a + b;
|
||||
return Sample{c.real(), c.imag()};
|
||||
}
|
||||
|
||||
Sample cf2sMul(std::complex<float>& a, const std::complex<float>& b)
|
||||
{
|
||||
std::complex<float> c = a * b;
|
||||
return Sample{c.real(), c.imag()};
|
||||
}
|
||||
|
||||
Sample cf2s(std::complex<float>& a)
|
||||
{
|
||||
return Sample{a.real(), a.imag()};
|
||||
}
|
||||
|
||||
const unsigned int InterferometerCorrelator::m_nbFFTBlocks = 128;
|
||||
|
||||
InterferometerCorrelator::InterferometerCorrelator(int fftSize) :
|
||||
m_corrType(InterferometerSettings::CorrelationAdd),
|
||||
m_fftSize(fftSize)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
m_fft[i] = FFTEngine::create();
|
||||
m_fft[i]->configure(2*fftSize, false); // internally twice the data FFT size
|
||||
m_data[i] = new std::complex<float>[fftSize*m_nbFFTBlocks];
|
||||
m_dataIndex[i] = 0;
|
||||
}
|
||||
|
||||
m_invFFT = FFTEngine::create();
|
||||
m_invFFT->configure(2*fftSize, true);
|
||||
|
||||
m_dataj = new std::complex<float>[2*fftSize]; // receives actual FFT result hence twice the data FFT size
|
||||
m_scorr.resize(2*fftSize*m_nbFFTBlocks); // same size multiplied by the number of buffered FFT blocks
|
||||
m_tcorr.resize(2*fftSize*m_nbFFTBlocks); // same size multiplied by the number of buffered FFT blocks
|
||||
}
|
||||
|
||||
InterferometerCorrelator::~InterferometerCorrelator()
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
delete[] m_data[i];
|
||||
delete[] m_fft[i];
|
||||
}
|
||||
|
||||
delete[] m_dataj;
|
||||
}
|
||||
|
||||
void InterferometerCorrelator::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int argIndex)
|
||||
{
|
||||
if (argIndex > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (m_corrType)
|
||||
{
|
||||
case InterferometerSettings::CorrelationAdd:
|
||||
feedOp(begin, end, argIndex, cf2sAdd);
|
||||
break;
|
||||
case InterferometerSettings::CorrelationMultiply:
|
||||
feedOp(begin, end, argIndex, cf2sMul);
|
||||
break;
|
||||
case InterferometerSettings::CorrelationCorrelation:
|
||||
feedCorr(begin, end, argIndex);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void InterferometerCorrelator::feedOp(
|
||||
const SampleVector::const_iterator& begin,
|
||||
const SampleVector::const_iterator& end,
|
||||
unsigned int argIndex,
|
||||
Sample complexOp(std::complex<float>& a, const std::complex<float>& b)
|
||||
)
|
||||
{
|
||||
int size = (end - begin);
|
||||
int fill = m_fftSize*m_nbFFTBlocks - m_dataIndex[argIndex];
|
||||
int first = std::min(fill, size);
|
||||
|
||||
std::transform(begin, begin + first, m_data[argIndex] + m_dataIndex[argIndex], [](const Sample& s) -> std::complex<float> {
|
||||
return std::complex<float>{s.real() / SDR_RX_SCALEF, s.imag() / SDR_RX_SCALEF};
|
||||
});
|
||||
|
||||
if (argIndex == 1)
|
||||
{
|
||||
std::transform(
|
||||
m_data[0] + m_dataIndex[0], m_data[0] + m_dataIndex[0] + first, m_data[1] + m_dataIndex[1],
|
||||
m_tcorr.begin() + m_dataIndex[0],
|
||||
complexOp
|
||||
);
|
||||
|
||||
emit dataReady(m_dataIndex[0], m_dataIndex[0] + first);
|
||||
}
|
||||
|
||||
if (size > fill)
|
||||
{
|
||||
std::transform(begin, begin + size - fill , m_data[argIndex], [](const Sample& s) -> std::complex<float> {
|
||||
return std::complex<float>{s.real() / SDR_RX_SCALEF, s.imag() / SDR_RX_SCALEF};
|
||||
});
|
||||
|
||||
if (argIndex == 1)
|
||||
{
|
||||
std::transform(
|
||||
m_data[0], m_data[0] + size - fill, m_data[1],
|
||||
m_tcorr.begin(),
|
||||
complexOp
|
||||
);
|
||||
|
||||
emit dataReady(0, size - fill);
|
||||
}
|
||||
|
||||
m_dataIndex[argIndex] = size - fill;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataIndex[argIndex] += size;
|
||||
}
|
||||
}
|
||||
|
||||
void InterferometerCorrelator::feedCorr(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int argIndex)
|
||||
{
|
||||
int size = (end - begin);
|
||||
int fill = m_fftSize*m_nbFFTBlocks - m_dataIndex[argIndex];
|
||||
int first = std::min(fill, size);
|
||||
|
||||
std::transform(begin, begin + first, m_data[argIndex] + m_dataIndex[argIndex], [](const Sample& s) -> std::complex<float> {
|
||||
return std::complex<float>{s.real() / SDR_RX_SCALEF, s.imag() / SDR_RX_SCALEF};
|
||||
});
|
||||
processFFTBlocks(argIndex, m_dataIndex[argIndex], first);
|
||||
|
||||
if (size > fill)
|
||||
{
|
||||
std::transform(begin, begin + size - fill, m_data[argIndex], [](const Sample& s) -> std::complex<float> {
|
||||
return std::complex<float>{s.real() / SDR_RX_SCALEF, s.imag() / SDR_RX_SCALEF};
|
||||
});
|
||||
processFFTBlocks(argIndex, 0, size - fill);
|
||||
m_dataIndex[argIndex] = size - fill;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataIndex[argIndex] += size;
|
||||
}
|
||||
}
|
||||
|
||||
void InterferometerCorrelator::processFFTBlocks(unsigned int argIndex, unsigned int dataIndex, int length)
|
||||
{
|
||||
int start = dataIndex / m_fftSize;
|
||||
int stop = (dataIndex + length) / m_fftSize;
|
||||
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
m_window.apply(&m_data[argIndex][start*m_fftSize], m_fft[argIndex]->in());
|
||||
std::fill(m_fft[argIndex]->in() + m_fftSize, m_fft[argIndex]->in() + 2*m_fftSize, std::complex<float>{0,0});
|
||||
m_fft[argIndex]->transform();
|
||||
|
||||
if (argIndex == m_corrIndex)
|
||||
{
|
||||
// conjugate
|
||||
std::transform(m_fft[argIndex]->out(), m_fft[argIndex]->out()+2*m_fftSize, m_dataj, []
|
||||
(const std::complex<float>& c) -> std::complex<float> { return std::conj(c); }
|
||||
);
|
||||
// product with FFT[0] store in inverse FFT input
|
||||
std::transform(m_fft[0]->out(), m_fft[0]->out()+2*m_fftSize, m_dataj, m_invFFT->in(), []
|
||||
(std::complex<float>& a, const std::complex<float>& b) -> std::complex<float> { return a*b; }
|
||||
);
|
||||
// copy to correlation spectrum and do the inverse FFT to get time correlation
|
||||
std::transform(m_invFFT->in(), m_invFFT->in() + 2*m_fftSize, m_scorr.begin() + 2*i*m_fftSize, cf2s);
|
||||
m_invFFT->transform();
|
||||
std::transform(m_invFFT->out(), m_invFFT->out() + 2*m_fftSize, m_tcorr.begin() + 2*i*m_fftSize, cf2s);
|
||||
}
|
||||
}
|
||||
|
||||
if (start != stop) {
|
||||
emit dataReady(start, stop);
|
||||
}
|
||||
}
|
||||
71
plugins/channelmimo/interferometer/interferometercorr.h
Normal file
71
plugins/channelmimo/interferometer/interferometercorr.h
Normal file
@ -0,0 +1,71 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INTERFEROMETERCORR_H
|
||||
#define INCLUDE_INTERFEROMETERCORR_H
|
||||
|
||||
#include <complex>
|
||||
#include <QObject>
|
||||
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "dsp/fftwindow.h"
|
||||
#include "util/message.h"
|
||||
|
||||
#include "interferometersettings.h"
|
||||
|
||||
class FFTEngine;
|
||||
|
||||
class InterferometerCorrelator : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
InterferometerCorrelator(int fftSize);
|
||||
~InterferometerCorrelator();
|
||||
|
||||
void setCorrIndex(unsigned int corrIndex) { m_corrIndex = corrIndex; }
|
||||
void setCorrType(InterferometerSettings::CorrelationType corrType) { m_corrType = corrType; }
|
||||
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int argIndex);
|
||||
|
||||
SampleVector m_scorr; //!< raw correlation result (spectrum) - Sample vector expected
|
||||
SampleVector m_tcorr; //!< correlation result (time or spectrum inverse FFT) - Sample vector expected
|
||||
|
||||
signals:
|
||||
void dataReady(int start, int stop);
|
||||
|
||||
private:
|
||||
void feedOp(
|
||||
const SampleVector::const_iterator& begin,
|
||||
const SampleVector::const_iterator& end,
|
||||
unsigned int argIndex,
|
||||
Sample complexOp(std::complex<float>& a, const std::complex<float>& b)
|
||||
);
|
||||
void feedCorr(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int argIndex);
|
||||
void processFFTBlocks(unsigned int argIndex, unsigned int dataIndex, int length);
|
||||
void processFFT(unsigned int argIndex, int blockIndex);
|
||||
|
||||
InterferometerSettings::CorrelationType m_corrType;
|
||||
int m_fftSize; //!< FFT length
|
||||
FFTEngine *m_fft[2]; //!< FFT engines
|
||||
FFTEngine *m_invFFT; //!< Inverse FFT engine
|
||||
FFTWindow m_window; //!< FFT window
|
||||
std::complex<float> *m_data[2]; //!< from input
|
||||
std::complex<float> *m_dataj; //!< conjuate of FFT transform
|
||||
unsigned int m_dataIndex[2]; //!< Current sample index in A
|
||||
unsigned int m_corrIndex; //!< Input index on which correlation is actioned
|
||||
static const unsigned int m_nbFFTBlocks; //!< number of buffered FFT blocks
|
||||
};
|
||||
|
||||
#endif // INCLUDE_INTERFEROMETERCORR_H
|
||||
520
plugins/channelmimo/interferometer/interferometergui.ui
Normal file
520
plugins/channelmimo/interferometer/interferometergui.ui
Normal file
@ -0,0 +1,520 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChannelAnalyzerGUI</class>
|
||||
<widget class="RollupWidget" name="ChannelAnalyzerGUI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>739</width>
|
||||
<height>778</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>720</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Interferometer</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="settingsContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>631</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="HeaderLayout">
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="DeltaFrequencyLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="deltaFrequencyLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Df</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDialZ" name="deltaFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Demod shift frequency from center in Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="deltaUnits">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>26</red>
|
||||
<green>26</green>
|
||||
<blue>26</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>26</red>
|
||||
<green>26</green>
|
||||
<blue>26</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>118</red>
|
||||
<green>118</green>
|
||||
<blue>117</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="ChannelSamplingLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="spanLog2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel decimation</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>16</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>32</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>64</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="spanText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel final sample rate</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00000.0 kS/s</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="signalSelect">
|
||||
<property name="toolTip">
|
||||
<string>Select input signal</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sig</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Lock</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ACorr</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="channelPower">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>52</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel power</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-100.0 dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="BWLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="BWLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>15</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>BP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="BW">
|
||||
<property name="toolTip">
|
||||
<string>Lowpass filter cutoff frequency</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-60</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="BWText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>3.0k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="spectrumContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>98</y>
|
||||
<width>720</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>716</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Channel Spectrum</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutSpectrum">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="GLSpectrum" name="glSpectrum" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GLSpectrumGUI" name="spectrumGUI" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="scopeContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>390</y>
|
||||
<width>720</width>
|
||||
<height>334</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>716</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Channel Scope</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutScope">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="GLScope" name="glScope" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GLScopeGUI" name="scopeGUI" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RollupWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/rollupwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLSpectrum</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/glspectrum.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLSpectrumGUI</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/glspectrumgui.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLScope</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/glscope.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GLScopeGUI</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/glscopegui.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
105
plugins/channelmimo/interferometer/interferometersettings.cpp
Normal file
105
plugins/channelmimo/interferometer/interferometersettings.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include "dsp/dspengine.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "settings/serializable.h"
|
||||
|
||||
#include "interferometersettings.h"
|
||||
|
||||
InterferometerSettings::InterferometerSettings() :
|
||||
m_channelMarker(nullptr),
|
||||
m_spectrumGUI(nullptr),
|
||||
m_scopeGUI(nullptr)
|
||||
{
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
void InterferometerSettings::resetToDefaults()
|
||||
{
|
||||
m_inputFrequencyOffset = 0;
|
||||
m_correlationType = CorrelationAdd;
|
||||
m_rgbColor = QColor(128, 128, 128).rgb();
|
||||
m_title = "Interferometer";
|
||||
}
|
||||
|
||||
QByteArray InterferometerSettings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeS32(1, m_inputFrequencyOffset);
|
||||
s.writeS32(2, (int) m_correlationType);
|
||||
s.writeU32(3, m_rgbColor);
|
||||
s.writeString(4, m_title);
|
||||
|
||||
if (m_spectrumGUI) {
|
||||
s.writeBlob(20, m_spectrumGUI->serialize());
|
||||
}
|
||||
if (m_scopeGUI) {
|
||||
s.writeBlob(21, m_scopeGUI->serialize());
|
||||
}
|
||||
if (m_channelMarker) {
|
||||
s.writeBlob(22, m_channelMarker->serialize());
|
||||
}
|
||||
}
|
||||
|
||||
bool InterferometerSettings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if(!d.isValid())
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(d.getVersion() == 1)
|
||||
{
|
||||
QByteArray bytetmp;
|
||||
int tmp;
|
||||
|
||||
d.readS32(1, &m_inputFrequencyOffset, 0);
|
||||
d.readS32(2, &tmp, 0);
|
||||
m_correlationType = (CorrelationType) tmp;
|
||||
d.readU32(3, &m_rgbColor);
|
||||
d.readString(4, &m_title, "Interpolator");
|
||||
|
||||
if (m_spectrumGUI) {
|
||||
d.readBlob(20, &bytetmp);
|
||||
m_spectrumGUI->deserialize(bytetmp);
|
||||
}
|
||||
|
||||
if (m_scopeGUI) {
|
||||
d.readBlob(21, &bytetmp);
|
||||
m_scopeGUI->deserialize(bytetmp);
|
||||
}
|
||||
|
||||
if (m_channelMarker) {
|
||||
d.readBlob(21, &bytetmp);
|
||||
m_channelMarker->deserialize(bytetmp);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
52
plugins/channelmimo/interferometer/interferometersettings.h
Normal file
52
plugins/channelmimo/interferometer/interferometersettings.h
Normal file
@ -0,0 +1,52 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INTERFEROMETERSETTINGS_H
|
||||
#define INCLUDE_INTERFEROMETERSETTINGS_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
class Serializable;
|
||||
|
||||
struct InterferometerSettings
|
||||
{
|
||||
enum CorrelationType
|
||||
{
|
||||
CorrelationAdd,
|
||||
CorrelationMultiply,
|
||||
CorrelationCorrelation
|
||||
};
|
||||
|
||||
qint32 m_inputFrequencyOffset;
|
||||
CorrelationType m_correlationType;
|
||||
quint32 m_rgbColor;
|
||||
QString m_title;
|
||||
Serializable *m_channelMarker;
|
||||
Serializable *m_spectrumGUI;
|
||||
Serializable *m_scopeGUI;
|
||||
|
||||
InterferometerSettings();
|
||||
void resetToDefaults();
|
||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
|
||||
void setScopeGUI(Serializable *scopeGUI) { m_scopeGUI = scopeGUI; }
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_INTERFEROMETERSETTINGS_H
|
||||
45
plugins/channelmimo/interferometer/interferometersink.cpp
Normal file
45
plugins/channelmimo/interferometer/interferometersink.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "interferometersink.h"
|
||||
|
||||
InterferometerSink::InterferometerSink(InterferometerCorrelator *correlator) :
|
||||
m_processingUnit(false),
|
||||
m_correlator(correlator)
|
||||
{}
|
||||
|
||||
InterferometerSink::~InterferometerSink()
|
||||
{}
|
||||
|
||||
void InterferometerSink::start()
|
||||
{}
|
||||
|
||||
void InterferometerSink::stop()
|
||||
{}
|
||||
|
||||
void InterferometerSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||
{
|
||||
(void) positiveOnly;
|
||||
(void) begin;
|
||||
(void) end;
|
||||
}
|
||||
|
||||
bool InterferometerSink::handleMessage(const Message& cmd)
|
||||
{
|
||||
(void) cmd;
|
||||
return false;
|
||||
}
|
||||
44
plugins/channelmimo/interferometer/interferometersink.h
Normal file
44
plugins/channelmimo/interferometer/interferometersink.h
Normal file
@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INTERFEROMETERSINK_H
|
||||
#define INCLUDE_INTERFEROMETERSINK_H
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
|
||||
class InterferometerCorrelator;
|
||||
|
||||
class InterferometerSink : public BasebandSampleSink
|
||||
{
|
||||
public:
|
||||
InterferometerSink(InterferometerCorrelator *correlator);
|
||||
virtual ~InterferometerSink();
|
||||
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
void setProcessingUnit(bool) { m_processingUnit = m_processingUnit; }
|
||||
bool isProcessingUnit() const { return m_processingUnit; }
|
||||
|
||||
private:
|
||||
bool m_processingUnit; //!< True if it is responsible of starting the correlation process
|
||||
InterferometerCorrelator *m_correlator;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_INTERFEROMETERSINK_H
|
||||
@ -0,0 +1,389 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "interferometerwebapiadapter.h"
|
||||
|
||||
InterferometerWebAPIAdapter::InterferometerWebAPIAdapter()
|
||||
{
|
||||
m_settings.setScopeGUI(&m_glScopeSettings);
|
||||
m_settings.setSpectrumGUI(&m_glSpectrumSettings);
|
||||
}
|
||||
|
||||
InterferometerWebAPIAdapter::~InterferometerWebAPIAdapter()
|
||||
{}
|
||||
|
||||
int InterferometerWebAPIAdapter::webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setInterferometerSettings(new SWGSDRangel::SWGInterferometerSettings());
|
||||
response.getInterferometerSettings()->init();
|
||||
webapiFormatChannelSettings(response, m_settings, m_glScopeSettings, m_glSpectrumSettings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void InterferometerWebAPIAdapter::webapiFormatChannelSettings(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const InterferometerSettings& settings,
|
||||
const GLScopeSettings& scopeSettings,
|
||||
const GLSpectrumSettings& spectrumSettings)
|
||||
{
|
||||
response.getInterferometerSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
response.getInterferometerSettings()->setCorrelationType((int) settings.m_correlationType);
|
||||
response.getInterferometerSettings()->setRgbColor(settings.m_rgbColor);
|
||||
response.getInterferometerSettings()->setTitle(new QString(settings.m_title));
|
||||
|
||||
// scope
|
||||
SWGSDRangel::SWGGLScope *swgScope = new SWGSDRangel::SWGGLScope();
|
||||
swgScope->init();
|
||||
response.getInterferometerSettings()->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<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();
|
||||
swgSpectrum->init();
|
||||
response.getInterferometerSettings()->setSpectrumConfig(swgSpectrum);
|
||||
swgSpectrum->setAveragingMode((int) spectrumSettings.m_averagingMode);
|
||||
swgSpectrum->setAveragingValue(spectrumSettings.m_averagingNb);
|
||||
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);
|
||||
}
|
||||
|
||||
int InterferometerWebAPIAdapter::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) force;
|
||||
(void) errorMessage;
|
||||
webapiUpdateChannelSettings(m_settings, m_glScopeSettings, m_glSpectrumSettings, channelSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void InterferometerWebAPIAdapter::webapiUpdateChannelSettings(
|
||||
InterferometerSettings& settings,
|
||||
GLScopeSettings& scopeSettings,
|
||||
GLSpectrumSettings& spectrumSettings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response)
|
||||
{
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
||||
settings.m_inputFrequencyOffset = response.getInterferometerSettings()->getInputFrequencyOffset();
|
||||
}
|
||||
if (channelSettingsKeys.contains("correlationType")) {
|
||||
settings.m_correlationType = (InterferometerSettings::CorrelationType) response.getInterferometerSettings()->getCorrelationType();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor")) {
|
||||
settings.m_rgbColor = response.getInterferometerSettings()->getRgbColor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
settings.m_title = *response.getInterferometerSettings()->getTitle();
|
||||
}
|
||||
// scope
|
||||
if (channelSettingsKeys.contains("scopeConfig"))
|
||||
{
|
||||
if (channelSettingsKeys.contains("scopeConfig.displayMode")) {
|
||||
scopeSettings.m_displayMode = (GLScopeSettings::DisplayMode) response.getInterferometerSettings()->getScopeConfig()->getDisplayMode();
|
||||
}
|
||||
if (channelSettingsKeys.contains("scopeConfig.gridIntensity")) {
|
||||
scopeSettings.m_gridIntensity = response.getInterferometerSettings()->getScopeConfig()->getGridIntensity();
|
||||
}
|
||||
if (channelSettingsKeys.contains("scopeConfig.time")) {
|
||||
scopeSettings.m_time = response.getInterferometerSettings()->getScopeConfig()->getTime();
|
||||
}
|
||||
if (channelSettingsKeys.contains("scopeConfig.timeOfs")) {
|
||||
scopeSettings.m_timeOfs = response.getInterferometerSettings()->getScopeConfig()->getTimeOfs();
|
||||
}
|
||||
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.trigPre")) {
|
||||
scopeSettings.m_trigPre = response.getInterferometerSettings()->getScopeConfig()->getTrigPre();
|
||||
}
|
||||
// traces
|
||||
if (channelSettingsKeys.contains("scopeConfig.tracesData"))
|
||||
{
|
||||
QList<SWGSDRangel::SWGTraceData *> *tracesData = response.getInterferometerSettings()->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].amp").arg(i))) {
|
||||
scopeSettings.m_tracesData.back().m_amp = traceData->getAmp();
|
||||
}
|
||||
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].ampIndex").arg(i))) {
|
||||
scopeSettings.m_tracesData.back().m_ampIndex = traceData->getAmpIndex();
|
||||
}
|
||||
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_inputIndex = traceData->getInputIndex();
|
||||
}
|
||||
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].ofsCoarse").arg(i))) {
|
||||
scopeSettings.m_tracesData.back().m_ofsCoarse = traceData->getOfsCoarse();
|
||||
}
|
||||
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].ofsFine").arg(i))) {
|
||||
scopeSettings.m_tracesData.back().m_ofsFine = traceData->getOfsFine();
|
||||
}
|
||||
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<SWGSDRangel::SWGTriggerData *> *triggersData = response.getInterferometerSettings()->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].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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// spectrum
|
||||
if (channelSettingsKeys.contains("spectrumConfig"))
|
||||
{
|
||||
if (channelSettingsKeys.contains("spectrumConfig.averagingMode")) {
|
||||
spectrumSettings.m_averagingMode = (GLSpectrumSettings::AveragingMode) response.getInterferometerSettings()->getSpectrumConfig()->getAveragingMode();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.averagingValue")) {
|
||||
spectrumSettings.m_averagingNb = response.getInterferometerSettings()->getSpectrumConfig()->getAveragingValue();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.decay")) {
|
||||
spectrumSettings.m_decay = response.getInterferometerSettings()->getSpectrumConfig()->getDecay();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.decayDivisor")) {
|
||||
spectrumSettings.m_decayDivisor = response.getInterferometerSettings()->getSpectrumConfig()->getDecayDivisor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.displayCurrent")) {
|
||||
spectrumSettings.m_displayCurrent = response.getInterferometerSettings()->getSpectrumConfig()->getDisplayCurrent() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.displayGrid")) {
|
||||
spectrumSettings.m_displayGrid = response.getInterferometerSettings()->getSpectrumConfig()->getDisplayGrid() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.displayGridIntensity")) {
|
||||
spectrumSettings.m_displayGridIntensity = response.getInterferometerSettings()->getSpectrumConfig()->getDisplayGridIntensity();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.displayHistogram")) {
|
||||
spectrumSettings.m_displayHistogram = response.getInterferometerSettings()->getSpectrumConfig()->getDisplayHistogram() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.displayMaxHold")) {
|
||||
spectrumSettings.m_displayMaxHold = response.getInterferometerSettings()->getSpectrumConfig()->getDisplayMaxHold() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.displayTraceIntensity")) {
|
||||
spectrumSettings.m_displayTraceIntensity = response.getInterferometerSettings()->getSpectrumConfig()->getDisplayTraceIntensity();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.displayWaterfall")) {
|
||||
spectrumSettings.m_displayWaterfall = response.getInterferometerSettings()->getSpectrumConfig()->getDisplayWaterfall() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.fftOverlap")) {
|
||||
spectrumSettings.m_fftOverlap = response.getInterferometerSettings()->getSpectrumConfig()->getFftOverlap();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.fftSize")) {
|
||||
spectrumSettings.m_fftSize = response.getInterferometerSettings()->getSpectrumConfig()->getFftSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int InterferometerWebAPIAdapter::qColorToInt(const QColor& color)
|
||||
{
|
||||
return 256*256*color.blue() + 256*color.green() + color.red();
|
||||
}
|
||||
|
||||
QColor InterferometerWebAPIAdapter::intToQColor(int intColor)
|
||||
{
|
||||
int r = intColor % 256;
|
||||
int bg = intColor / 256;
|
||||
int g = bg % 256;
|
||||
int b = bg / 256;
|
||||
return QColor(r, g, b);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_INTERFEROMETER_WEBAPIADAPTER_H
|
||||
#define INCLUDE_INTERFEROMETER_WEBAPIADAPTER_H
|
||||
|
||||
#include "channel/channelwebapiadapter.h"
|
||||
#include "dsp/glscopesettings.h"
|
||||
#include "dsp/glspectrumsettings.h"
|
||||
#include "interferometersettings.h"
|
||||
|
||||
/**
|
||||
* Standalone API adapter only for the settings
|
||||
*/
|
||||
class InterferometerWebAPIAdapter : public ChannelWebAPIAdapter {
|
||||
public:
|
||||
InterferometerWebAPIAdapter();
|
||||
virtual ~InterferometerWebAPIAdapter();
|
||||
|
||||
virtual QByteArray serialize() const { return m_settings.serialize(); }
|
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
|
||||
|
||||
virtual int webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatChannelSettings(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const InterferometerSettings& settings,
|
||||
const GLScopeSettings& scopeSettings,
|
||||
const GLSpectrumSettings& spectrumSettings);
|
||||
|
||||
static void webapiUpdateChannelSettings(
|
||||
InterferometerSettings& settings,
|
||||
GLScopeSettings& scopeSettings,
|
||||
GLSpectrumSettings& spectrumSettings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response);
|
||||
|
||||
private:
|
||||
InterferometerSettings m_settings;
|
||||
GLScopeSettings m_glScopeSettings;
|
||||
GLSpectrumSettings m_glSpectrumSettings;
|
||||
|
||||
static int qColorToInt(const QColor& color);
|
||||
static QColor intToQColor(int intColor);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_INTERFEROMETER_WEBAPIADAPTER_H
|
||||
@ -30,6 +30,7 @@
|
||||
<file>webapi/doc/swagger/include/GLScope.yaml</file>
|
||||
<file>webapi/doc/swagger/include/GLSpectrum.yaml</file>
|
||||
<file>webapi/doc/swagger/include/HackRF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/Interferometer.yaml</file>
|
||||
<file>webapi/doc/swagger/include/LimeSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/KiwiSDR.yaml</file>
|
||||
<file>webapi/doc/swagger/include/LocalInput.yaml</file>
|
||||
|
||||
@ -2226,6 +2226,9 @@ margin-bottom: 20px;
|
||||
"FreqTrackerSettings" : {
|
||||
"$ref" : "#/definitions/FreqTrackerSettings"
|
||||
},
|
||||
"InterferometerSettings" : {
|
||||
"$ref" : "#/definitions/InterferometerSettings"
|
||||
},
|
||||
"NFMDemodSettings" : {
|
||||
"$ref" : "#/definitions/NFMDemodSettings"
|
||||
},
|
||||
@ -3856,6 +3859,30 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "Summarized information about this SDRangel instance"
|
||||
};
|
||||
defs.InterferometerSettings = {
|
||||
"properties" : {
|
||||
"inputFrequencyOffset" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"correlationType" : {
|
||||
"type" : "integer",
|
||||
"description" : "see InterferometerSettings::CorrelationType"
|
||||
},
|
||||
"rgbColor" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"spectrumConfig" : {
|
||||
"$ref" : "#/definitions/GLSpectrum"
|
||||
},
|
||||
"scopeConfig" : {
|
||||
"$ref" : "#/definitions/GLScope"
|
||||
}
|
||||
},
|
||||
"description" : "Interferometer"
|
||||
};
|
||||
defs.KiwiSDRReport = {
|
||||
"properties" : {
|
||||
|
||||
@ -41,6 +41,8 @@ ChannelSettings:
|
||||
$ref: "/doc/swagger/include/FreeDVMod.yaml#/FreeDVModSettings"
|
||||
FreqTrackerSettings:
|
||||
$ref: "/doc/swagger/include/FreqTracker.yaml#/FreqTrackerSettings"
|
||||
InterferometerSettings:
|
||||
$ref: "/doc/swagger/include/Interferometer.yaml#/InterferometerSettings"
|
||||
NFMDemodSettings:
|
||||
$ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
|
||||
NFMModSettings:
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
InterferometerSettings:
|
||||
description: Interferometer
|
||||
properties:
|
||||
inputFrequencyOffset:
|
||||
type: integer
|
||||
correlationType:
|
||||
description: see InterferometerSettings::CorrelationType
|
||||
type: integer
|
||||
rgbColor:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
spectrumConfig:
|
||||
$ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum"
|
||||
scopeConfig:
|
||||
$ref: "/doc/swagger/include/GLScope.yaml#/GLScope"
|
||||
@ -41,6 +41,8 @@ ChannelSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/FreeDVMod.yaml#/FreeDVModSettings"
|
||||
FreqTrackerSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/FreqTracker.yaml#/FreqTrackerSettings"
|
||||
InterferometerSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/Interferometer.yaml#/InterferometerSettings"
|
||||
NFMDemodSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
|
||||
NFMModSettings:
|
||||
|
||||
16
swagger/sdrangel/api/swagger/include/Interferometer.yaml
Normal file
16
swagger/sdrangel/api/swagger/include/Interferometer.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
InterferometerSettings:
|
||||
description: Interferometer
|
||||
properties:
|
||||
inputFrequencyOffset:
|
||||
type: integer
|
||||
correlationType:
|
||||
description: see InterferometerSettings::CorrelationType
|
||||
type: integer
|
||||
rgbColor:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
spectrumConfig:
|
||||
$ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum"
|
||||
scopeConfig:
|
||||
$ref: "http://localhost:8081/api/swagger/include/GLScope.yaml#/GLScope"
|
||||
@ -2226,6 +2226,9 @@ margin-bottom: 20px;
|
||||
"FreqTrackerSettings" : {
|
||||
"$ref" : "#/definitions/FreqTrackerSettings"
|
||||
},
|
||||
"InterferometerSettings" : {
|
||||
"$ref" : "#/definitions/InterferometerSettings"
|
||||
},
|
||||
"NFMDemodSettings" : {
|
||||
"$ref" : "#/definitions/NFMDemodSettings"
|
||||
},
|
||||
@ -3856,6 +3859,30 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "Summarized information about this SDRangel instance"
|
||||
};
|
||||
defs.InterferometerSettings = {
|
||||
"properties" : {
|
||||
"inputFrequencyOffset" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"correlationType" : {
|
||||
"type" : "integer",
|
||||
"description" : "see InterferometerSettings::CorrelationType"
|
||||
},
|
||||
"rgbColor" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"spectrumConfig" : {
|
||||
"$ref" : "#/definitions/GLSpectrum"
|
||||
},
|
||||
"scopeConfig" : {
|
||||
"$ref" : "#/definitions/GLScope"
|
||||
}
|
||||
},
|
||||
"description" : "Interferometer"
|
||||
};
|
||||
defs.KiwiSDRReport = {
|
||||
"properties" : {
|
||||
|
||||
@ -60,6 +60,8 @@ SWGChannelSettings::SWGChannelSettings() {
|
||||
m_free_dv_mod_settings_isSet = false;
|
||||
freq_tracker_settings = nullptr;
|
||||
m_freq_tracker_settings_isSet = false;
|
||||
interferometer_settings = nullptr;
|
||||
m_interferometer_settings_isSet = false;
|
||||
nfm_demod_settings = nullptr;
|
||||
m_nfm_demod_settings_isSet = false;
|
||||
nfm_mod_settings = nullptr;
|
||||
@ -124,6 +126,8 @@ SWGChannelSettings::init() {
|
||||
m_free_dv_mod_settings_isSet = false;
|
||||
freq_tracker_settings = new SWGFreqTrackerSettings();
|
||||
m_freq_tracker_settings_isSet = false;
|
||||
interferometer_settings = new SWGInterferometerSettings();
|
||||
m_interferometer_settings_isSet = false;
|
||||
nfm_demod_settings = new SWGNFMDemodSettings();
|
||||
m_nfm_demod_settings_isSet = false;
|
||||
nfm_mod_settings = new SWGNFMModSettings();
|
||||
@ -194,6 +198,9 @@ SWGChannelSettings::cleanup() {
|
||||
if(freq_tracker_settings != nullptr) {
|
||||
delete freq_tracker_settings;
|
||||
}
|
||||
if(interferometer_settings != nullptr) {
|
||||
delete interferometer_settings;
|
||||
}
|
||||
if(nfm_demod_settings != nullptr) {
|
||||
delete nfm_demod_settings;
|
||||
}
|
||||
@ -275,6 +282,8 @@ SWGChannelSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&freq_tracker_settings, pJson["FreqTrackerSettings"], "SWGFreqTrackerSettings", "SWGFreqTrackerSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&interferometer_settings, pJson["InterferometerSettings"], "SWGInterferometerSettings", "SWGInterferometerSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_demod_settings, pJson["NFMDemodSettings"], "SWGNFMDemodSettings", "SWGNFMDemodSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_mod_settings, pJson["NFMModSettings"], "SWGNFMModSettings", "SWGNFMModSettings");
|
||||
@ -363,6 +372,9 @@ SWGChannelSettings::asJsonObject() {
|
||||
if((freq_tracker_settings != nullptr) && (freq_tracker_settings->isSet())){
|
||||
toJsonValue(QString("FreqTrackerSettings"), freq_tracker_settings, obj, QString("SWGFreqTrackerSettings"));
|
||||
}
|
||||
if((interferometer_settings != nullptr) && (interferometer_settings->isSet())){
|
||||
toJsonValue(QString("InterferometerSettings"), interferometer_settings, obj, QString("SWGInterferometerSettings"));
|
||||
}
|
||||
if((nfm_demod_settings != nullptr) && (nfm_demod_settings->isSet())){
|
||||
toJsonValue(QString("NFMDemodSettings"), nfm_demod_settings, obj, QString("SWGNFMDemodSettings"));
|
||||
}
|
||||
@ -563,6 +575,16 @@ SWGChannelSettings::setFreqTrackerSettings(SWGFreqTrackerSettings* freq_tracker_
|
||||
this->m_freq_tracker_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGInterferometerSettings*
|
||||
SWGChannelSettings::getInterferometerSettings() {
|
||||
return interferometer_settings;
|
||||
}
|
||||
void
|
||||
SWGChannelSettings::setInterferometerSettings(SWGInterferometerSettings* interferometer_settings) {
|
||||
this->interferometer_settings = interferometer_settings;
|
||||
this->m_interferometer_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGNFMDemodSettings*
|
||||
SWGChannelSettings::getNfmDemodSettings() {
|
||||
return nfm_demod_settings;
|
||||
@ -736,6 +758,9 @@ SWGChannelSettings::isSet(){
|
||||
if(freq_tracker_settings && freq_tracker_settings->isSet()){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(interferometer_settings && interferometer_settings->isSet()){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(nfm_demod_settings && nfm_demod_settings->isSet()){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "SWGFreeDVDemodSettings.h"
|
||||
#include "SWGFreeDVModSettings.h"
|
||||
#include "SWGFreqTrackerSettings.h"
|
||||
#include "SWGInterferometerSettings.h"
|
||||
#include "SWGLocalSinkSettings.h"
|
||||
#include "SWGLocalSourceSettings.h"
|
||||
#include "SWGNFMDemodSettings.h"
|
||||
@ -114,6 +115,9 @@ public:
|
||||
SWGFreqTrackerSettings* getFreqTrackerSettings();
|
||||
void setFreqTrackerSettings(SWGFreqTrackerSettings* freq_tracker_settings);
|
||||
|
||||
SWGInterferometerSettings* getInterferometerSettings();
|
||||
void setInterferometerSettings(SWGInterferometerSettings* interferometer_settings);
|
||||
|
||||
SWGNFMDemodSettings* getNfmDemodSettings();
|
||||
void setNfmDemodSettings(SWGNFMDemodSettings* nfm_demod_settings);
|
||||
|
||||
@ -202,6 +206,9 @@ private:
|
||||
SWGFreqTrackerSettings* freq_tracker_settings;
|
||||
bool m_freq_tracker_settings_isSet;
|
||||
|
||||
SWGInterferometerSettings* interferometer_settings;
|
||||
bool m_interferometer_settings_isSet;
|
||||
|
||||
SWGNFMDemodSettings* nfm_demod_settings;
|
||||
bool m_nfm_demod_settings_isSet;
|
||||
|
||||
|
||||
229
swagger/sdrangel/code/qt5/client/SWGInterferometerSettings.cpp
Normal file
229
swagger/sdrangel/code/qt5/client/SWGInterferometerSettings.cpp
Normal file
@ -0,0 +1,229 @@
|
||||
/**
|
||||
* 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: 4.11.6
|
||||
* 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 "SWGInterferometerSettings.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGInterferometerSettings::SWGInterferometerSettings(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGInterferometerSettings::SWGInterferometerSettings() {
|
||||
input_frequency_offset = 0;
|
||||
m_input_frequency_offset_isSet = false;
|
||||
correlation_type = 0;
|
||||
m_correlation_type_isSet = false;
|
||||
rgb_color = 0;
|
||||
m_rgb_color_isSet = false;
|
||||
title = nullptr;
|
||||
m_title_isSet = false;
|
||||
spectrum_config = nullptr;
|
||||
m_spectrum_config_isSet = false;
|
||||
scope_config = nullptr;
|
||||
m_scope_config_isSet = false;
|
||||
}
|
||||
|
||||
SWGInterferometerSettings::~SWGInterferometerSettings() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGInterferometerSettings::init() {
|
||||
input_frequency_offset = 0;
|
||||
m_input_frequency_offset_isSet = false;
|
||||
correlation_type = 0;
|
||||
m_correlation_type_isSet = false;
|
||||
rgb_color = 0;
|
||||
m_rgb_color_isSet = false;
|
||||
title = new QString("");
|
||||
m_title_isSet = false;
|
||||
spectrum_config = new SWGGLSpectrum();
|
||||
m_spectrum_config_isSet = false;
|
||||
scope_config = new SWGGLScope();
|
||||
m_scope_config_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGInterferometerSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
if(title != nullptr) {
|
||||
delete title;
|
||||
}
|
||||
if(spectrum_config != nullptr) {
|
||||
delete spectrum_config;
|
||||
}
|
||||
if(scope_config != nullptr) {
|
||||
delete scope_config;
|
||||
}
|
||||
}
|
||||
|
||||
SWGInterferometerSettings*
|
||||
SWGInterferometerSettings::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGInterferometerSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&correlation_type, pJson["correlationType"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum");
|
||||
|
||||
::SWGSDRangel::setValue(&scope_config, pJson["scopeConfig"], "SWGGLScope", "SWGGLScope");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGInterferometerSettings::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGInterferometerSettings::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_input_frequency_offset_isSet){
|
||||
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
|
||||
}
|
||||
if(m_correlation_type_isSet){
|
||||
obj->insert("correlationType", QJsonValue(correlation_type));
|
||||
}
|
||||
if(m_rgb_color_isSet){
|
||||
obj->insert("rgbColor", QJsonValue(rgb_color));
|
||||
}
|
||||
if(title != nullptr && *title != QString("")){
|
||||
toJsonValue(QString("title"), title, obj, QString("QString"));
|
||||
}
|
||||
if((spectrum_config != nullptr) && (spectrum_config->isSet())){
|
||||
toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum"));
|
||||
}
|
||||
if((scope_config != nullptr) && (scope_config->isSet())){
|
||||
toJsonValue(QString("scopeConfig"), scope_config, obj, QString("SWGGLScope"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGInterferometerSettings::getInputFrequencyOffset() {
|
||||
return input_frequency_offset;
|
||||
}
|
||||
void
|
||||
SWGInterferometerSettings::setInputFrequencyOffset(qint32 input_frequency_offset) {
|
||||
this->input_frequency_offset = input_frequency_offset;
|
||||
this->m_input_frequency_offset_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGInterferometerSettings::getCorrelationType() {
|
||||
return correlation_type;
|
||||
}
|
||||
void
|
||||
SWGInterferometerSettings::setCorrelationType(qint32 correlation_type) {
|
||||
this->correlation_type = correlation_type;
|
||||
this->m_correlation_type_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGInterferometerSettings::getRgbColor() {
|
||||
return rgb_color;
|
||||
}
|
||||
void
|
||||
SWGInterferometerSettings::setRgbColor(qint32 rgb_color) {
|
||||
this->rgb_color = rgb_color;
|
||||
this->m_rgb_color_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGInterferometerSettings::getTitle() {
|
||||
return title;
|
||||
}
|
||||
void
|
||||
SWGInterferometerSettings::setTitle(QString* title) {
|
||||
this->title = title;
|
||||
this->m_title_isSet = true;
|
||||
}
|
||||
|
||||
SWGGLSpectrum*
|
||||
SWGInterferometerSettings::getSpectrumConfig() {
|
||||
return spectrum_config;
|
||||
}
|
||||
void
|
||||
SWGInterferometerSettings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) {
|
||||
this->spectrum_config = spectrum_config;
|
||||
this->m_spectrum_config_isSet = true;
|
||||
}
|
||||
|
||||
SWGGLScope*
|
||||
SWGInterferometerSettings::getScopeConfig() {
|
||||
return scope_config;
|
||||
}
|
||||
void
|
||||
SWGInterferometerSettings::setScopeConfig(SWGGLScope* scope_config) {
|
||||
this->scope_config = scope_config;
|
||||
this->m_scope_config_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGInterferometerSettings::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_input_frequency_offset_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_correlation_type_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_rgb_color_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(title && *title != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(spectrum_config && spectrum_config->isSet()){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(scope_config && scope_config->isSet()){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
||||
91
swagger/sdrangel/code/qt5/client/SWGInterferometerSettings.h
Normal file
91
swagger/sdrangel/code/qt5/client/SWGInterferometerSettings.h
Normal file
@ -0,0 +1,91 @@
|
||||
/**
|
||||
* 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: 4.11.6
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGInterferometerSettings.h
|
||||
*
|
||||
* Interferometer
|
||||
*/
|
||||
|
||||
#ifndef SWGInterferometerSettings_H_
|
||||
#define SWGInterferometerSettings_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGGLScope.h"
|
||||
#include "SWGGLSpectrum.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGInterferometerSettings: public SWGObject {
|
||||
public:
|
||||
SWGInterferometerSettings();
|
||||
SWGInterferometerSettings(QString* json);
|
||||
virtual ~SWGInterferometerSettings();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGInterferometerSettings* fromJson(QString &jsonString) override;
|
||||
|
||||
qint32 getInputFrequencyOffset();
|
||||
void setInputFrequencyOffset(qint32 input_frequency_offset);
|
||||
|
||||
qint32 getCorrelationType();
|
||||
void setCorrelationType(qint32 correlation_type);
|
||||
|
||||
qint32 getRgbColor();
|
||||
void setRgbColor(qint32 rgb_color);
|
||||
|
||||
QString* getTitle();
|
||||
void setTitle(QString* title);
|
||||
|
||||
SWGGLSpectrum* getSpectrumConfig();
|
||||
void setSpectrumConfig(SWGGLSpectrum* spectrum_config);
|
||||
|
||||
SWGGLScope* getScopeConfig();
|
||||
void setScopeConfig(SWGGLScope* scope_config);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
qint32 input_frequency_offset;
|
||||
bool m_input_frequency_offset_isSet;
|
||||
|
||||
qint32 correlation_type;
|
||||
bool m_correlation_type_isSet;
|
||||
|
||||
qint32 rgb_color;
|
||||
bool m_rgb_color_isSet;
|
||||
|
||||
QString* title;
|
||||
bool m_title_isSet;
|
||||
|
||||
SWGGLSpectrum* spectrum_config;
|
||||
bool m_spectrum_config_isSet;
|
||||
|
||||
SWGGLScope* scope_config;
|
||||
bool m_scope_config_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGInterferometerSettings_H_ */
|
||||
@ -89,6 +89,7 @@
|
||||
#include "SWGInstanceConfigResponse.h"
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGInstanceSummaryResponse.h"
|
||||
#include "SWGInterferometerSettings.h"
|
||||
#include "SWGKiwiSDRReport.h"
|
||||
#include "SWGKiwiSDRSettings.h"
|
||||
#include "SWGLimeSdrInputReport.h"
|
||||
@ -396,6 +397,9 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGInstanceSummaryResponse").compare(type) == 0) {
|
||||
return new SWGInstanceSummaryResponse();
|
||||
}
|
||||
if(QString("SWGInterferometerSettings").compare(type) == 0) {
|
||||
return new SWGInterferometerSettings();
|
||||
}
|
||||
if(QString("SWGKiwiSDRReport").compare(type) == 0) {
|
||||
return new SWGKiwiSDRReport();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user