mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 13:11:20 -05:00 
			
		
		
		
	DOA2: replaced spectrum by compass
This commit is contained in:
		
							parent
							
								
									6290677889
								
							
						
					
					
						commit
						5557c5b67c
					
				@ -29,11 +29,13 @@ if (NOT SERVER_MODE)
 | 
			
		||||
    set(doa2_SOURCES
 | 
			
		||||
        ${doa2_SOURCES}
 | 
			
		||||
        doa2gui.cpp
 | 
			
		||||
        doa2compass.cpp
 | 
			
		||||
        doa2gui.ui
 | 
			
		||||
    )
 | 
			
		||||
    set(doa2_HEADERS
 | 
			
		||||
        ${doa2_HEADERS}
 | 
			
		||||
        doa2gui.h
 | 
			
		||||
        doa2compass.cpp
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    set(TARGET_NAME doa2)
 | 
			
		||||
 | 
			
		||||
@ -43,7 +43,6 @@ const int DOA2::m_fftSize = 4096;
 | 
			
		||||
DOA2::DOA2(DeviceAPI *deviceAPI) :
 | 
			
		||||
    ChannelAPI(m_channelIdURI, ChannelAPI::StreamMIMO),
 | 
			
		||||
    m_deviceAPI(deviceAPI),
 | 
			
		||||
    m_spectrumVis(SDR_RX_SCALEF),
 | 
			
		||||
    m_guiMessageQueue(nullptr),
 | 
			
		||||
    m_frequencyOffset(0),
 | 
			
		||||
    m_deviceSampleRate(48000)
 | 
			
		||||
@ -52,7 +51,6 @@ DOA2::DOA2(DeviceAPI *deviceAPI) :
 | 
			
		||||
 | 
			
		||||
    m_thread = new QThread(this);
 | 
			
		||||
    m_basebandSink = new DOA2Baseband(m_fftSize);
 | 
			
		||||
    m_basebandSink->setSpectrumSink(&m_spectrumVis);
 | 
			
		||||
    m_basebandSink->setScopeSink(&m_scopeSink);
 | 
			
		||||
    m_basebandSink->moveToThread(m_thread);
 | 
			
		||||
    m_deviceAPI->addMIMOChannel(this);
 | 
			
		||||
@ -375,9 +373,6 @@ void DOA2::webapiUpdateChannelSettings(
 | 
			
		||||
    if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
 | 
			
		||||
        settings.m_reverseAPIChannelIndex = response.getDoa2Settings()->getReverseApiChannelIndex();
 | 
			
		||||
    }
 | 
			
		||||
    if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) {
 | 
			
		||||
        settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getDoa2Settings()->getSpectrumConfig());
 | 
			
		||||
    }
 | 
			
		||||
    if (settings.m_scopeGUI && channelSettingsKeys.contains("scopeConfig")) {
 | 
			
		||||
        settings.m_scopeGUI->updateFrom(channelSettingsKeys, response.getDoa2Settings()->getScopeConfig());
 | 
			
		||||
    }
 | 
			
		||||
@ -413,20 +408,6 @@ void DOA2::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response
 | 
			
		||||
    response.getDoa2Settings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
 | 
			
		||||
    response.getDoa2Settings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
 | 
			
		||||
 | 
			
		||||
    if (settings.m_spectrumGUI)
 | 
			
		||||
    {
 | 
			
		||||
        if (response.getDoa2Settings()->getSpectrumConfig())
 | 
			
		||||
        {
 | 
			
		||||
            settings.m_spectrumGUI->formatTo(response.getDoa2Settings()->getSpectrumConfig());
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
 | 
			
		||||
            settings.m_spectrumGUI->formatTo(swgGLSpectrum);
 | 
			
		||||
            response.getDoa2Settings()->setSpectrumConfig(swgGLSpectrum);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (settings.m_scopeGUI)
 | 
			
		||||
    {
 | 
			
		||||
        if (response.getDoa2Settings()->getScopeConfig())
 | 
			
		||||
@ -549,13 +530,6 @@ void DOA2::webapiFormatChannelSettings(
 | 
			
		||||
        swgDOA2Settings->setFilterChainHash(settings.m_filterChainHash);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (settings.m_spectrumGUI)
 | 
			
		||||
    {
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig") || force) {
 | 
			
		||||
            settings.m_spectrumGUI->formatTo(swgDOA2Settings->getSpectrumConfig());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (settings.m_scopeGUI)
 | 
			
		||||
    {
 | 
			
		||||
        if (channelSettingsKeys.contains("scopeConfig") || force) {
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,6 @@
 | 
			
		||||
#include <QNetworkRequest>
 | 
			
		||||
 | 
			
		||||
#include "dsp/mimochannel.h"
 | 
			
		||||
#include "dsp/spectrumvis.h"
 | 
			
		||||
#include "dsp/scopevis.h"
 | 
			
		||||
#include "channel/channelapi.h"
 | 
			
		||||
#include "util/messagequeue.h"
 | 
			
		||||
@ -124,7 +123,6 @@ public:
 | 
			
		||||
    virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
 | 
			
		||||
    MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
 | 
			
		||||
 | 
			
		||||
    SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
 | 
			
		||||
    ScopeVis *getScopeVis() { return &m_scopeSink; }
 | 
			
		||||
    void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash);
 | 
			
		||||
 | 
			
		||||
@ -158,7 +156,6 @@ public:
 | 
			
		||||
private:
 | 
			
		||||
    DeviceAPI *m_deviceAPI;
 | 
			
		||||
    QThread *m_thread;
 | 
			
		||||
    SpectrumVis m_spectrumVis;
 | 
			
		||||
    ScopeVis m_scopeSink;
 | 
			
		||||
    DOA2Baseband* m_basebandSink;
 | 
			
		||||
    DOA2Settings m_settings;
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,6 @@ MESSAGE_CLASS_DEFINITION(DOA2Baseband::MsgConfigureCorrelation, Message)
 | 
			
		||||
 | 
			
		||||
DOA2Baseband::DOA2Baseband(int fftSize) :
 | 
			
		||||
    m_correlator(fftSize),
 | 
			
		||||
    m_spectrumSink(nullptr),
 | 
			
		||||
    m_scopeSink(nullptr),
 | 
			
		||||
    m_mutex(QMutex::Recursive)
 | 
			
		||||
{
 | 
			
		||||
@ -149,21 +148,6 @@ void DOA2Baseband::run()
 | 
			
		||||
            vbegin.push_back(m_correlator.m_tcorr.begin());
 | 
			
		||||
            m_scopeSink->feed(vbegin, m_correlator.m_processed);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (m_spectrumSink)
 | 
			
		||||
        {
 | 
			
		||||
            if ((m_correlator.getCorrType() == DOA2Settings::CorrelationFFT)
 | 
			
		||||
             || (m_correlator.getCorrType() == DOA2Settings::CorrelationIFFT)
 | 
			
		||||
             || (m_correlator.getCorrType() == DOA2Settings::CorrelationIFFT2)
 | 
			
		||||
             || (m_correlator.getCorrType() == DOA2Settings::CorrelationIFFTStar))
 | 
			
		||||
            {
 | 
			
		||||
                m_spectrumSink->feed(m_correlator.m_scorr.begin(), m_correlator.m_scorr.begin() + m_correlator.m_processed, false);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                m_spectrumSink->feed(m_correlator.m_tcorr.begin(), m_correlator.m_tcorr.begin() + m_correlator.m_processed, false);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (int i = 0; i < 2; i++)
 | 
			
		||||
 | 
			
		||||
@ -105,7 +105,6 @@ public:
 | 
			
		||||
 | 
			
		||||
    MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
 | 
			
		||||
 | 
			
		||||
    void setSpectrumSink(BasebandSampleSink *spectrumSink) { m_spectrumSink = spectrumSink; }
 | 
			
		||||
    void setScopeSink(ScopeVis *scopeSink) { m_scopeSink = scopeSink; }
 | 
			
		||||
    void setPhase(int phase) { m_correlator.setPhase(phase); }
 | 
			
		||||
 | 
			
		||||
@ -123,7 +122,6 @@ private:
 | 
			
		||||
    int m_sizes[2];
 | 
			
		||||
    DOA2StreamSink m_sinks[2];
 | 
			
		||||
    DownChannelizer *m_channelizers[2];
 | 
			
		||||
    BasebandSampleSink *m_spectrumSink;
 | 
			
		||||
    ScopeVis *m_scopeSink;
 | 
			
		||||
	MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
 | 
			
		||||
    QMutex m_mutex;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										277
									
								
								plugins/channelmimo/doa2/doa2compass.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										277
									
								
								plugins/channelmimo/doa2/doa2compass.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,277 @@
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// Copyright (C) 2022 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 <QtCore>
 | 
			
		||||
#include <QtGui>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
#include "doa2compass.h"
 | 
			
		||||
 | 
			
		||||
DOA2Compass::DOA2Compass(QWidget *parent)
 | 
			
		||||
    : QWidget(parent)
 | 
			
		||||
{
 | 
			
		||||
    connect(this, SIGNAL(canvasReplot(void)), this, SLOT(canvasReplot_slot(void)));
 | 
			
		||||
 | 
			
		||||
    m_sizeMin = 200;
 | 
			
		||||
    m_sizeMax = 600;
 | 
			
		||||
    m_offset = 2;
 | 
			
		||||
    m_size = m_sizeMin - 2*m_offset;
 | 
			
		||||
 | 
			
		||||
    setMinimumSize(m_sizeMin, m_sizeMin);
 | 
			
		||||
    setMaximumSize(m_sizeMax, m_sizeMax);
 | 
			
		||||
    resize(m_sizeMin, m_sizeMin);
 | 
			
		||||
 | 
			
		||||
    setFocusPolicy(Qt::NoFocus);
 | 
			
		||||
 | 
			
		||||
    m_yaw  = 0.0;
 | 
			
		||||
    m_alt  = 0.0;
 | 
			
		||||
    m_h    = 0.0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DOA2Compass::~DOA2Compass()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void DOA2Compass::canvasReplot_slot(void)
 | 
			
		||||
{
 | 
			
		||||
    update();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DOA2Compass::resizeEvent(QResizeEvent *event)
 | 
			
		||||
{
 | 
			
		||||
    m_size = qMin(width(),height()) - 2*m_offset;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DOA2Compass::paintEvent(QPaintEvent *)
 | 
			
		||||
{
 | 
			
		||||
    QPainter painter(this);
 | 
			
		||||
 | 
			
		||||
    QBrush bgGround(QColor(48,172,220));
 | 
			
		||||
 | 
			
		||||
    QPen   whitePen(Qt::white);
 | 
			
		||||
    QPen   blackPen(Qt::black);
 | 
			
		||||
    QPen   redPen(Qt::red);
 | 
			
		||||
    QPen   bluePen(Qt::blue);
 | 
			
		||||
    QPen   greenPen(Qt::green);
 | 
			
		||||
 | 
			
		||||
    whitePen.setWidth(1);
 | 
			
		||||
    blackPen.setWidth(2);
 | 
			
		||||
    redPen.setWidth(2);
 | 
			
		||||
    bluePen.setWidth(2);
 | 
			
		||||
    greenPen.setWidth(2);
 | 
			
		||||
 | 
			
		||||
    painter.setRenderHint(QPainter::Antialiasing);
 | 
			
		||||
 | 
			
		||||
    painter.translate(width() / 2, height() / 2);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // draw background
 | 
			
		||||
    {
 | 
			
		||||
        painter.setPen(blackPen);
 | 
			
		||||
        painter.setBrush(bgGround);
 | 
			
		||||
 | 
			
		||||
        painter.drawEllipse(-m_size/2, -m_size/2, m_size, m_size);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // draw yaw lines
 | 
			
		||||
    {
 | 
			
		||||
        int     nyawLines = 36;
 | 
			
		||||
        float   rotAng = 360.0 / nyawLines;
 | 
			
		||||
        int     yawLineLeng = m_size/25;
 | 
			
		||||
        double  fx1, fy1, fx2, fy2;
 | 
			
		||||
        int     fontSize = 8;
 | 
			
		||||
        QString s;
 | 
			
		||||
 | 
			
		||||
        blackPen.setWidth(1);
 | 
			
		||||
        painter.setPen(blackPen);
 | 
			
		||||
 | 
			
		||||
        for(int i=0; i<nyawLines; i++) {
 | 
			
		||||
 | 
			
		||||
            if( i == 0 ) {
 | 
			
		||||
                s = "N";
 | 
			
		||||
                painter.setPen(bluePen);
 | 
			
		||||
 | 
			
		||||
                painter.setFont(QFont("", fontSize*1.3));
 | 
			
		||||
            } else if ( i == 9 ) {
 | 
			
		||||
                s = "W";
 | 
			
		||||
                painter.setPen(blackPen);
 | 
			
		||||
 | 
			
		||||
                painter.setFont(QFont("", fontSize*1.3));
 | 
			
		||||
            } else if ( i == 18 ) {
 | 
			
		||||
                s = "S";
 | 
			
		||||
                painter.setPen(redPen);
 | 
			
		||||
 | 
			
		||||
                painter.setFont(QFont("", fontSize*1.3));
 | 
			
		||||
            } else if ( i == 27 ) {
 | 
			
		||||
                s = "E";
 | 
			
		||||
                painter.setPen(blackPen);
 | 
			
		||||
 | 
			
		||||
                painter.setFont(QFont("", fontSize*1.3));
 | 
			
		||||
            } else {
 | 
			
		||||
                s = QString("%1").arg(i*rotAng);
 | 
			
		||||
                painter.setPen(blackPen);
 | 
			
		||||
 | 
			
		||||
                painter.setFont(QFont("", fontSize));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            fx1 = 0;
 | 
			
		||||
            fy1 = -m_size/2 + m_offset;
 | 
			
		||||
            fx2 = 0;
 | 
			
		||||
 | 
			
		||||
            if( i % 3 == 0 ) {
 | 
			
		||||
                fy2 = fy1 + yawLineLeng;
 | 
			
		||||
                painter.drawLine(QPointF(fx1, fy1), QPointF(fx2, fy2));
 | 
			
		||||
 | 
			
		||||
                fy2 = fy1 + yawLineLeng+4;
 | 
			
		||||
                painter.drawText(QRectF(-50, fy2, 100, fontSize+2),
 | 
			
		||||
                                 Qt::AlignCenter, s);
 | 
			
		||||
            } else {
 | 
			
		||||
                fy2 = fy1 + yawLineLeng/2;
 | 
			
		||||
                painter.drawLine(QPointF(fx1, fy1), QPointF(fx2, fy2));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            painter.rotate(-rotAng);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // draw S/N arrow
 | 
			
		||||
    {
 | 
			
		||||
        int     arrowWidth = m_size/5;
 | 
			
		||||
        double  fx1, fy1, fx2, fy2, fx3, fy3;
 | 
			
		||||
 | 
			
		||||
        fx1 = 0;
 | 
			
		||||
        fy1 = -m_size/2 + m_offset + m_size/25 + 15;
 | 
			
		||||
        fx2 = -arrowWidth/2;
 | 
			
		||||
        fy2 = 0;
 | 
			
		||||
        fx3 = arrowWidth/2;
 | 
			
		||||
        fy3 = 0;
 | 
			
		||||
 | 
			
		||||
        painter.setPen(Qt::NoPen);
 | 
			
		||||
 | 
			
		||||
        painter.setBrush(QBrush(Qt::blue));
 | 
			
		||||
        QPointF pointsN[3] = {
 | 
			
		||||
            QPointF(fx1, fy1),
 | 
			
		||||
            QPointF(fx2, fy2),
 | 
			
		||||
            QPointF(fx3, fy3)
 | 
			
		||||
        };
 | 
			
		||||
        painter.drawPolygon(pointsN, 3);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        fx1 = 0;
 | 
			
		||||
        fy1 = m_size/2 - m_offset - m_size/25 - 15;
 | 
			
		||||
        fx2 = -arrowWidth/2;
 | 
			
		||||
        fy2 = 0;
 | 
			
		||||
        fx3 = arrowWidth/2;
 | 
			
		||||
        fy3 = 0;
 | 
			
		||||
 | 
			
		||||
        painter.setBrush(QBrush(Qt::red));
 | 
			
		||||
        QPointF pointsS[3] = {
 | 
			
		||||
            QPointF(fx1, fy1),
 | 
			
		||||
            QPointF(fx2, fy2),
 | 
			
		||||
            QPointF(fx3, fy3)
 | 
			
		||||
        };
 | 
			
		||||
        painter.drawPolygon(pointsS, 3);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // draw yaw marker
 | 
			
		||||
    {
 | 
			
		||||
        int     yawMarkerSize = m_size/12;
 | 
			
		||||
        double  fx1, fy1, fx2, fy2, fx3, fy3;
 | 
			
		||||
 | 
			
		||||
        painter.rotate(-m_yaw);
 | 
			
		||||
        painter.setBrush(QBrush(QColor(0xFF, 0x00, 0x00, 0xE0)));
 | 
			
		||||
 | 
			
		||||
        fx1 = 0;
 | 
			
		||||
        fy1 = -m_size/2 + m_offset;
 | 
			
		||||
        fx2 = fx1 - yawMarkerSize/2;
 | 
			
		||||
        fy2 = fy1 + yawMarkerSize;
 | 
			
		||||
        fx3 = fx1 + yawMarkerSize/2;
 | 
			
		||||
        fy3 = fy1 + yawMarkerSize;
 | 
			
		||||
 | 
			
		||||
        QPointF points[3] = {
 | 
			
		||||
            QPointF(fx1, fy1),
 | 
			
		||||
            QPointF(fx2, fy2),
 | 
			
		||||
            QPointF(fx3, fy3)
 | 
			
		||||
        };
 | 
			
		||||
        painter.drawPolygon(points, 3);
 | 
			
		||||
 | 
			
		||||
        painter.rotate(m_yaw);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // draw altitude
 | 
			
		||||
    {
 | 
			
		||||
        int     altFontSize = 13;
 | 
			
		||||
        int     fx, fy, w, h;
 | 
			
		||||
        QString s;
 | 
			
		||||
        char    buf[200];
 | 
			
		||||
 | 
			
		||||
        w  = 130;
 | 
			
		||||
        h  = 2*(altFontSize + 8);
 | 
			
		||||
        fx = -w/2;
 | 
			
		||||
        fy = -h/2;
 | 
			
		||||
 | 
			
		||||
        blackPen.setWidth(2);
 | 
			
		||||
        painter.setPen(blackPen);
 | 
			
		||||
        painter.setBrush(QBrush(Qt::white));
 | 
			
		||||
        painter.setFont(QFont("", altFontSize));
 | 
			
		||||
 | 
			
		||||
        painter.drawRoundedRect(fx, fy, w, h, 6, 6);
 | 
			
		||||
 | 
			
		||||
        painter.setPen(bluePen);
 | 
			
		||||
        sprintf(buf, "ALT: %6.1f m", m_alt);
 | 
			
		||||
        s = buf;
 | 
			
		||||
        painter.drawText(QRectF(fx, fy+2, w, h/2), Qt::AlignCenter, s);
 | 
			
		||||
 | 
			
		||||
        sprintf(buf, "H: %6.1f m", m_h);
 | 
			
		||||
        s = buf;
 | 
			
		||||
        painter.drawText(QRectF(fx, fy+h/2, w, h/2), Qt::AlignCenter, s);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DOA2Compass::keyPressEvent(QKeyEvent *event)
 | 
			
		||||
{
 | 
			
		||||
    switch (event->key()) {
 | 
			
		||||
    case Qt::Key_Left:
 | 
			
		||||
        m_yaw -= 1.0;
 | 
			
		||||
        break;
 | 
			
		||||
    case Qt::Key_Right:
 | 
			
		||||
        m_yaw += 1.0;
 | 
			
		||||
        break;
 | 
			
		||||
    case Qt::Key_Down:
 | 
			
		||||
        m_alt -= 1.0;
 | 
			
		||||
        break;
 | 
			
		||||
    case Qt::Key_Up:
 | 
			
		||||
        m_alt += 1.0;
 | 
			
		||||
        break;
 | 
			
		||||
    case Qt::Key_W:
 | 
			
		||||
        m_h += 1.0;
 | 
			
		||||
        break;
 | 
			
		||||
    case Qt::Key_S:
 | 
			
		||||
        m_h -= 1.0;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
        QWidget::keyPressEvent(event);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    update();
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										119
									
								
								plugins/channelmimo/doa2/doa2compass.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								plugins/channelmimo/doa2/doa2compass.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,119 @@
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// Copyright (C) 2022 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_DOA2COMPASS_H
 | 
			
		||||
#define INCLUDE_DOA2COMPASS_H
 | 
			
		||||
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
class DOA2Compass : public QWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    DOA2Compass(QWidget *parent = nullptr);
 | 
			
		||||
    ~DOA2Compass();
 | 
			
		||||
 | 
			
		||||
    ///
 | 
			
		||||
    /// \brief Set all data (yaw, alt, height)
 | 
			
		||||
    ///
 | 
			
		||||
    /// \param y - yaw ( in degree)
 | 
			
		||||
    /// \param a - altitude ( in m)
 | 
			
		||||
    /// \param h - height from ground (in m)
 | 
			
		||||
    ///
 | 
			
		||||
    void setData(double y, double a, double h) {
 | 
			
		||||
        m_yaw = y;
 | 
			
		||||
        m_alt = a;
 | 
			
		||||
        m_h   = h;
 | 
			
		||||
 | 
			
		||||
        if( m_yaw < 0   ) m_yaw = 360 + m_yaw;
 | 
			
		||||
        if( m_yaw > 360 ) m_yaw = m_yaw - 360;
 | 
			
		||||
 | 
			
		||||
        emit canvasReplot();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ///
 | 
			
		||||
    /// \brief Set yaw angle (in degree)
 | 
			
		||||
    /// \param val - yaw angle (in degree)
 | 
			
		||||
    ///
 | 
			
		||||
    void setYaw(double val) {
 | 
			
		||||
        m_yaw  = val;
 | 
			
		||||
        if( m_yaw < 0   ) m_yaw = 360 + m_yaw;
 | 
			
		||||
        if( m_yaw > 360 ) m_yaw = m_yaw - 360;
 | 
			
		||||
 | 
			
		||||
        emit canvasReplot();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ///
 | 
			
		||||
    /// \brief Set altitude value
 | 
			
		||||
    /// \param val - altitude (in m)
 | 
			
		||||
    ///
 | 
			
		||||
    void setAlt(double val) {
 | 
			
		||||
        m_alt = val;
 | 
			
		||||
 | 
			
		||||
        emit canvasReplot();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ///
 | 
			
		||||
    /// \brief Set height from ground
 | 
			
		||||
    /// \param val - height (in m)
 | 
			
		||||
    ///
 | 
			
		||||
    void setH(double val) {
 | 
			
		||||
        m_h = val;
 | 
			
		||||
 | 
			
		||||
        emit canvasReplot();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ///
 | 
			
		||||
    /// \brief Get yaw angle
 | 
			
		||||
    /// \return yaw angle (in degree)
 | 
			
		||||
    ///
 | 
			
		||||
    double getYaw() {return m_yaw;}
 | 
			
		||||
 | 
			
		||||
    ///
 | 
			
		||||
    /// \brief Get altitude value
 | 
			
		||||
    /// \return altitude (in m)
 | 
			
		||||
    ///
 | 
			
		||||
    double getAlt() {return m_alt;}
 | 
			
		||||
 | 
			
		||||
    ///
 | 
			
		||||
    /// \brief Get height from ground
 | 
			
		||||
    /// \return height from ground (in m)
 | 
			
		||||
    ///
 | 
			
		||||
    double getH()   {return m_h;}
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
    void canvasReplot(void);
 | 
			
		||||
 | 
			
		||||
protected slots:
 | 
			
		||||
    void canvasReplot_slot(void);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    void paintEvent(QPaintEvent *event);
 | 
			
		||||
    void resizeEvent(QResizeEvent *event);
 | 
			
		||||
    void keyPressEvent(QKeyEvent *event);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    int     m_sizeMin, m_sizeMax;               ///< widget min/max size (in pixel)
 | 
			
		||||
    int     m_size, m_offset;                   ///< widget size and offset size
 | 
			
		||||
 | 
			
		||||
    double  m_yaw;                              ///< yaw angle (in degree)
 | 
			
		||||
    double  m_alt;                              ///< altitude (in m)
 | 
			
		||||
    double  m_h;                                ///< height from ground (in m)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // INCLUDE_DOA2COMPASS_H
 | 
			
		||||
@ -87,7 +87,6 @@ bool DOA2GUI::handleMessage(const Message& message)
 | 
			
		||||
        const DOA2::MsgConfigureDOA2& notif = (const DOA2::MsgConfigureDOA2&) message;
 | 
			
		||||
        m_settings = notif.getSettings();
 | 
			
		||||
        ui->scopeGUI->updateSettings();
 | 
			
		||||
        ui->spectrumGUI->updateSettings();
 | 
			
		||||
        m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
 | 
			
		||||
        displaySettings();
 | 
			
		||||
        return true;
 | 
			
		||||
@ -117,19 +116,11 @@ DOA2GUI::DOA2GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *ch
 | 
			
		||||
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
 | 
			
		||||
 | 
			
		||||
    m_doa2 = (DOA2*) channelMIMO;
 | 
			
		||||
    m_spectrumVis = m_doa2->getSpectrumVis();
 | 
			
		||||
    m_spectrumVis->setGLSpectrum(ui->glSpectrum);
 | 
			
		||||
    m_scopeVis = m_doa2->getScopeVis();
 | 
			
		||||
    m_scopeVis->setGLScope(ui->glScope);
 | 
			
		||||
    m_doa2->setMessageQueueToGUI(getInputMessageQueue());
 | 
			
		||||
    m_sampleRate = m_doa2->getDeviceSampleRate();
 | 
			
		||||
 | 
			
		||||
	ui->glSpectrum->setDisplayWaterfall(true);
 | 
			
		||||
	ui->glSpectrum->setDisplayMaxHold(true);
 | 
			
		||||
    ui->glSpectrum->setCenterFrequency(0);
 | 
			
		||||
    ui->glSpectrum->setSampleRate(m_sampleRate);
 | 
			
		||||
	ui->glSpectrum->setSsbSpectrum(false);
 | 
			
		||||
    ui->glSpectrum->setLsbDisplay(false);
 | 
			
		||||
    ui->glScope->setTraceModulo(DOA2::m_fftSize);
 | 
			
		||||
 | 
			
		||||
	ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
 | 
			
		||||
@ -146,11 +137,9 @@ DOA2GUI::DOA2GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *ch
 | 
			
		||||
    m_settings.setChannelMarker(&m_channelMarker);
 | 
			
		||||
    m_settings.setRollupState(&m_rollupState);
 | 
			
		||||
    m_settings.setScopeGUI(ui->scopeGUI);
 | 
			
		||||
    m_settings.setSpectrumGUI(ui->spectrumGUI);
 | 
			
		||||
 | 
			
		||||
    m_deviceUISet->addChannelMarker(&m_channelMarker);
 | 
			
		||||
 | 
			
		||||
	ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
 | 
			
		||||
	ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
 | 
			
		||||
 | 
			
		||||
    m_scopeVis->setTraceChunkSize(DOA2::m_fftSize); // Set scope trace length unit to FFT size
 | 
			
		||||
@ -220,7 +209,6 @@ void DOA2GUI::displayRateAndShift()
 | 
			
		||||
    ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
 | 
			
		||||
    m_channelMarker.setCenterFrequency(shift);
 | 
			
		||||
    m_channelMarker.setBandwidth(channelSampleRate);
 | 
			
		||||
    ui->glSpectrum->setSampleRate(channelSampleRate);
 | 
			
		||||
    m_scopeVis->setLiveRate(channelSampleRate);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,6 @@ class PluginAPI;
 | 
			
		||||
class DeviceUISet;
 | 
			
		||||
class MIMOChannel;
 | 
			
		||||
class DOA2;
 | 
			
		||||
class SpectrumVis;
 | 
			
		||||
class ScopeVis;
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
@ -72,7 +71,6 @@ private:
 | 
			
		||||
    bool m_doApplySettings;
 | 
			
		||||
    MovingAverageUtil<double, double, 40> m_channelPowerAvg;
 | 
			
		||||
    DOA2 *m_doa2;
 | 
			
		||||
	SpectrumVis* m_spectrumVis;
 | 
			
		||||
	ScopeVis* m_scopeVis;
 | 
			
		||||
	MessageQueue m_inputMessageQueue;
 | 
			
		||||
    uint32_t m_tickCount;
 | 
			
		||||
 | 
			
		||||
@ -355,78 +355,11 @@
 | 
			
		||||
    </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="sizePolicy">
 | 
			
		||||
    <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
 | 
			
		||||
     <horstretch>0</horstretch>
 | 
			
		||||
     <verstretch>0</verstretch>
 | 
			
		||||
    </sizepolicy>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="minimumSize">
 | 
			
		||||
    <size>
 | 
			
		||||
     <width>718</width>
 | 
			
		||||
     <height>0</height>
 | 
			
		||||
    </size>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="windowTitle">
 | 
			
		||||
    <string>Frequency domain</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="sizePolicy">
 | 
			
		||||
       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
 | 
			
		||||
        <horstretch>0</horstretch>
 | 
			
		||||
        <verstretch>0</verstretch>
 | 
			
		||||
       </sizepolicy>
 | 
			
		||||
      </property>
 | 
			
		||||
      <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>
 | 
			
		||||
     <y>98</y>
 | 
			
		||||
     <width>720</width>
 | 
			
		||||
     <height>334</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
@ -489,6 +422,55 @@
 | 
			
		||||
    </item>
 | 
			
		||||
   </layout>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QWidget" name="doaContainer" native="true">
 | 
			
		||||
   <property name="geometry">
 | 
			
		||||
    <rect>
 | 
			
		||||
     <x>0</x>
 | 
			
		||||
     <y>432</y>
 | 
			
		||||
     <width>720</width>
 | 
			
		||||
     <height>284</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="sizePolicy">
 | 
			
		||||
    <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
 | 
			
		||||
     <horstretch>0</horstretch>
 | 
			
		||||
     <verstretch>0</verstretch>
 | 
			
		||||
    </sizepolicy>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="minimumSize">
 | 
			
		||||
    <size>
 | 
			
		||||
     <width>718</width>
 | 
			
		||||
     <height>0</height>
 | 
			
		||||
    </size>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="windowTitle">
 | 
			
		||||
    <string>DOA</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>12</number>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="bottomMargin">
 | 
			
		||||
     <number>2</number>
 | 
			
		||||
    </property>
 | 
			
		||||
    <item>
 | 
			
		||||
     <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="DOA2Compass" name="compass" native="true"/>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </item>
 | 
			
		||||
   </layout>
 | 
			
		||||
  </widget>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <customwidgets>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
@ -497,18 +479,6 @@
 | 
			
		||||
   <header>gui/rollupcontents.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>GLScope</class>
 | 
			
		||||
   <extends>QWidget</extends>
 | 
			
		||||
@ -521,6 +491,12 @@
 | 
			
		||||
   <header>gui/glscopegui.h</header>
 | 
			
		||||
   <container>1</container>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
   <class>DOA2Compass</class>
 | 
			
		||||
   <extends>QWidget</extends>
 | 
			
		||||
   <header>doa2compass.h</header>
 | 
			
		||||
   <container>1</container>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
 </customwidgets>
 | 
			
		||||
 <resources>
 | 
			
		||||
  <include location="../../../sdrgui/resources/res.qrc"/>
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,6 @@
 | 
			
		||||
 | 
			
		||||
DOA2Settings::DOA2Settings() :
 | 
			
		||||
    m_channelMarker(nullptr),
 | 
			
		||||
    m_spectrumGUI(nullptr),
 | 
			
		||||
    m_scopeGUI(nullptr),
 | 
			
		||||
    m_rollupState(nullptr)
 | 
			
		||||
{
 | 
			
		||||
@ -35,7 +34,7 @@ DOA2Settings::DOA2Settings() :
 | 
			
		||||
void DOA2Settings::resetToDefaults()
 | 
			
		||||
{
 | 
			
		||||
    m_correlationType = CorrelationAdd;
 | 
			
		||||
    m_rgbColor = QColor(250, 174, 120).rgb();
 | 
			
		||||
    m_rgbColor = QColor(250, 120, 120).rgb();
 | 
			
		||||
    m_title = "DOA 2 sources";
 | 
			
		||||
    m_log2Decim = 0;
 | 
			
		||||
    m_filterChainHash = 0;
 | 
			
		||||
@ -67,9 +66,6 @@ QByteArray DOA2Settings::serialize() const
 | 
			
		||||
    s.writeBlob(14, m_geometryBytes);
 | 
			
		||||
    s.writeBool(15, m_hidden);
 | 
			
		||||
 | 
			
		||||
    if (m_spectrumGUI) {
 | 
			
		||||
        s.writeBlob(20, m_spectrumGUI->serialize());
 | 
			
		||||
    }
 | 
			
		||||
    if (m_scopeGUI) {
 | 
			
		||||
        s.writeBlob(21, m_scopeGUI->serialize());
 | 
			
		||||
    }
 | 
			
		||||
@ -126,12 +122,6 @@ bool DOA2Settings::deserialize(const QByteArray& data)
 | 
			
		||||
        d.readBlob(14, &m_geometryBytes);
 | 
			
		||||
        d.readBool(15, &m_hidden, false);
 | 
			
		||||
 | 
			
		||||
        if (m_spectrumGUI)
 | 
			
		||||
        {
 | 
			
		||||
            d.readBlob(20, &bytetmp);
 | 
			
		||||
            m_spectrumGUI->deserialize(bytetmp);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (m_scopeGUI)
 | 
			
		||||
        {
 | 
			
		||||
            d.readBlob(21, &bytetmp);
 | 
			
		||||
 | 
			
		||||
@ -53,7 +53,6 @@ struct DOA2Settings
 | 
			
		||||
    bool m_hidden;
 | 
			
		||||
 | 
			
		||||
    Serializable *m_channelMarker;
 | 
			
		||||
    Serializable *m_spectrumGUI;
 | 
			
		||||
    Serializable *m_scopeGUI;
 | 
			
		||||
    Serializable *m_rollupState;
 | 
			
		||||
 | 
			
		||||
@ -61,7 +60,6 @@ struct DOA2Settings
 | 
			
		||||
    void resetToDefaults();
 | 
			
		||||
    void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
 | 
			
		||||
    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);
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,6 @@
 | 
			
		||||
DOA2WebAPIAdapter::DOA2WebAPIAdapter()
 | 
			
		||||
{
 | 
			
		||||
    m_settings.setScopeGUI(&m_glScopeSettings);
 | 
			
		||||
    m_settings.setSpectrumGUI(&m_SpectrumSettings);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DOA2WebAPIAdapter::~DOA2WebAPIAdapter()
 | 
			
		||||
@ -36,15 +35,14 @@ int DOA2WebAPIAdapter::webapiSettingsGet(
 | 
			
		||||
    (void) errorMessage;
 | 
			
		||||
    response.setDoa2Settings(new SWGSDRangel::SWGDOA2Settings());
 | 
			
		||||
    response.getDoa2Settings()->init();
 | 
			
		||||
    webapiFormatChannelSettings(response, m_settings, m_glScopeSettings, m_SpectrumSettings);
 | 
			
		||||
    webapiFormatChannelSettings(response, m_settings, m_glScopeSettings);
 | 
			
		||||
    return 200;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DOA2WebAPIAdapter::webapiFormatChannelSettings(
 | 
			
		||||
        SWGSDRangel::SWGChannelSettings& response,
 | 
			
		||||
        const DOA2Settings& settings,
 | 
			
		||||
        const GLScopeSettings& scopeSettings,
 | 
			
		||||
        const SpectrumSettings& spectrumSettings)
 | 
			
		||||
        const GLScopeSettings& scopeSettings)
 | 
			
		||||
{
 | 
			
		||||
    response.getDoa2Settings()->setCorrelationType((int) settings.m_correlationType);
 | 
			
		||||
    response.getDoa2Settings()->setRgbColor(settings.m_rgbColor);
 | 
			
		||||
@ -111,25 +109,6 @@ void DOA2WebAPIAdapter::webapiFormatChannelSettings(
 | 
			
		||||
        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.getDoa2Settings()->setSpectrumConfig(swgSpectrum);
 | 
			
		||||
    swgSpectrum->setAveragingMode((int) spectrumSettings.m_averagingMode);
 | 
			
		||||
    swgSpectrum->setAveragingValue(SpectrumSettings::getAveragingValue(spectrumSettings.m_averagingIndex, spectrumSettings.m_averagingMode));
 | 
			
		||||
    swgSpectrum->setDecay(spectrumSettings.m_decay);
 | 
			
		||||
    swgSpectrum->setDecayDivisor(spectrumSettings.m_decayDivisor);
 | 
			
		||||
    swgSpectrum->setDisplayCurrent(spectrumSettings.m_displayCurrent ? 1 : 0);
 | 
			
		||||
    swgSpectrum->setDisplayGrid(spectrumSettings.m_displayGrid ? 1 : 0);
 | 
			
		||||
    swgSpectrum->setDisplayGridIntensity(spectrumSettings.m_displayGridIntensity);
 | 
			
		||||
    swgSpectrum->setDisplayHistogram(spectrumSettings.m_displayHistogram ? 1 : 0);
 | 
			
		||||
    swgSpectrum->setDisplayMaxHold(spectrumSettings.m_displayMaxHold ? 1 : 0);
 | 
			
		||||
    swgSpectrum->setDisplayTraceIntensity(spectrumSettings.m_displayTraceIntensity);
 | 
			
		||||
    swgSpectrum->setDisplayWaterfall(spectrumSettings.m_displayWaterfall ? 1 : 0);
 | 
			
		||||
    swgSpectrum->setFftOverlap(spectrumSettings.m_fftOverlap);
 | 
			
		||||
    swgSpectrum->setFftSize(spectrumSettings.m_fftSize);
 | 
			
		||||
    swgSpectrum->setFpsPeriodMs(spectrumSettings.m_fpsPeriodMs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int DOA2WebAPIAdapter::webapiSettingsPutPatch(
 | 
			
		||||
@ -140,14 +119,13 @@ int DOA2WebAPIAdapter::webapiSettingsPutPatch(
 | 
			
		||||
{
 | 
			
		||||
    (void) force; // no action
 | 
			
		||||
    (void) errorMessage;
 | 
			
		||||
    webapiUpdateChannelSettings(m_settings, m_glScopeSettings, m_SpectrumSettings, channelSettingsKeys, response);
 | 
			
		||||
    webapiUpdateChannelSettings(m_settings, m_glScopeSettings, channelSettingsKeys, response);
 | 
			
		||||
    return 200;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DOA2WebAPIAdapter::webapiUpdateChannelSettings(
 | 
			
		||||
        DOA2Settings& settings,
 | 
			
		||||
        GLScopeSettings& scopeSettings,
 | 
			
		||||
        SpectrumSettings& spectrumSettings,
 | 
			
		||||
        const QStringList& channelSettingsKeys,
 | 
			
		||||
        SWGSDRangel::SWGChannelSettings& response)
 | 
			
		||||
{
 | 
			
		||||
@ -320,54 +298,6 @@ void DOA2WebAPIAdapter::webapiUpdateChannelSettings(
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    // spectrum
 | 
			
		||||
    if (channelSettingsKeys.contains("spectrumConfig"))
 | 
			
		||||
    {
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.averagingMode")) {
 | 
			
		||||
            spectrumSettings.m_averagingMode = (SpectrumSettings::AveragingMode) response.getDoa2Settings()->getSpectrumConfig()->getAveragingMode();
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.averagingValue"))
 | 
			
		||||
        {
 | 
			
		||||
            spectrumSettings.m_averagingValue = response.getDoa2Settings()->getSpectrumConfig()->getAveragingValue();
 | 
			
		||||
            spectrumSettings.m_averagingIndex = SpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode);
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.decay")) {
 | 
			
		||||
            spectrumSettings.m_decay = response.getDoa2Settings()->getSpectrumConfig()->getDecay();
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.decayDivisor")) {
 | 
			
		||||
            spectrumSettings.m_decayDivisor = response.getDoa2Settings()->getSpectrumConfig()->getDecayDivisor();
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.displayCurrent")) {
 | 
			
		||||
            spectrumSettings.m_displayCurrent = response.getDoa2Settings()->getSpectrumConfig()->getDisplayCurrent() != 0;
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.displayGrid")) {
 | 
			
		||||
            spectrumSettings.m_displayGrid = response.getDoa2Settings()->getSpectrumConfig()->getDisplayGrid() != 0;
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.displayGridIntensity")) {
 | 
			
		||||
            spectrumSettings.m_displayGridIntensity = response.getDoa2Settings()->getSpectrumConfig()->getDisplayGridIntensity();
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.displayHistogram")) {
 | 
			
		||||
            spectrumSettings.m_displayHistogram = response.getDoa2Settings()->getSpectrumConfig()->getDisplayHistogram() != 0;
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.displayMaxHold")) {
 | 
			
		||||
            spectrumSettings.m_displayMaxHold = response.getDoa2Settings()->getSpectrumConfig()->getDisplayMaxHold() != 0;
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.displayTraceIntensity")) {
 | 
			
		||||
            spectrumSettings.m_displayTraceIntensity = response.getDoa2Settings()->getSpectrumConfig()->getDisplayTraceIntensity();
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.displayWaterfall")) {
 | 
			
		||||
            spectrumSettings.m_displayWaterfall = response.getDoa2Settings()->getSpectrumConfig()->getDisplayWaterfall() != 0;
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.fftOverlap")) {
 | 
			
		||||
            spectrumSettings.m_fftOverlap = response.getDoa2Settings()->getSpectrumConfig()->getFftOverlap();
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.fftSize")) {
 | 
			
		||||
            spectrumSettings.m_fftSize = response.getDoa2Settings()->getSpectrumConfig()->getFftSize();
 | 
			
		||||
        }
 | 
			
		||||
        if (channelSettingsKeys.contains("spectrumConfig.fpsPeriodMs")) {
 | 
			
		||||
            spectrumSettings.m_fpsPeriodMs = response.getDoa2Settings()->getSpectrumConfig()->getFpsPeriodMs();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int DOA2WebAPIAdapter::qColorToInt(const QColor& color)
 | 
			
		||||
 | 
			
		||||
@ -47,20 +47,17 @@ public:
 | 
			
		||||
    static void webapiFormatChannelSettings(
 | 
			
		||||
            SWGSDRangel::SWGChannelSettings& response,
 | 
			
		||||
            const DOA2Settings& settings,
 | 
			
		||||
            const GLScopeSettings& scopeSettings,
 | 
			
		||||
            const SpectrumSettings& spectrumSettings);
 | 
			
		||||
            const GLScopeSettings& scopeSettings);
 | 
			
		||||
 | 
			
		||||
    static void webapiUpdateChannelSettings(
 | 
			
		||||
            DOA2Settings& settings,
 | 
			
		||||
            GLScopeSettings& scopeSettings,
 | 
			
		||||
            SpectrumSettings& spectrumSettings,
 | 
			
		||||
            const QStringList& channelSettingsKeys,
 | 
			
		||||
            SWGSDRangel::SWGChannelSettings& response);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    DOA2Settings m_settings;
 | 
			
		||||
    GLScopeSettings m_glScopeSettings;
 | 
			
		||||
    SpectrumSettings m_SpectrumSettings;
 | 
			
		||||
 | 
			
		||||
    static int qColorToInt(const QColor& color);
 | 
			
		||||
    static QColor intToQColor(int intColor);
 | 
			
		||||
 | 
			
		||||
@ -4560,9 +4560,6 @@ margin-bottom: 20px;
 | 
			
		||||
    "reverseAPIChannelIndex" : {
 | 
			
		||||
      "type" : "integer"
 | 
			
		||||
    },
 | 
			
		||||
    "spectrumConfig" : {
 | 
			
		||||
      "$ref" : "#/definitions/GLSpectrum"
 | 
			
		||||
    },
 | 
			
		||||
    "scopeConfig" : {
 | 
			
		||||
      "$ref" : "#/definitions/GLScope"
 | 
			
		||||
    },
 | 
			
		||||
@ -56112,7 +56109,7 @@ except ApiException as e:
 | 
			
		||||
          </div>
 | 
			
		||||
          <div id="generator">
 | 
			
		||||
            <div class="content">
 | 
			
		||||
              Generated 2022-05-27T00:17:01.671+02:00
 | 
			
		||||
              Generated 2022-05-27T09:54:03.529+02:00
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
@ -23,8 +23,6 @@ DOA2Settings:
 | 
			
		||||
      type: integer
 | 
			
		||||
    reverseAPIChannelIndex:
 | 
			
		||||
      type: integer
 | 
			
		||||
    spectrumConfig:
 | 
			
		||||
      $ref: "/doc/swagger/include/GLSpectrum.yaml#/GLSpectrum"
 | 
			
		||||
    scopeConfig:
 | 
			
		||||
      $ref: "/doc/swagger/include/GLScope.yaml#/GLScope"
 | 
			
		||||
    channelMarker:
 | 
			
		||||
 | 
			
		||||
@ -23,8 +23,6 @@ DOA2Settings:
 | 
			
		||||
      type: integer
 | 
			
		||||
    reverseAPIChannelIndex:
 | 
			
		||||
      type: integer
 | 
			
		||||
    spectrumConfig:
 | 
			
		||||
      $ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum"
 | 
			
		||||
    scopeConfig:
 | 
			
		||||
      $ref: "http://swgserver:8081/api/swagger/include/GLScope.yaml#/GLScope"
 | 
			
		||||
    channelMarker:
 | 
			
		||||
 | 
			
		||||
@ -4560,9 +4560,6 @@ margin-bottom: 20px;
 | 
			
		||||
    "reverseAPIChannelIndex" : {
 | 
			
		||||
      "type" : "integer"
 | 
			
		||||
    },
 | 
			
		||||
    "spectrumConfig" : {
 | 
			
		||||
      "$ref" : "#/definitions/GLSpectrum"
 | 
			
		||||
    },
 | 
			
		||||
    "scopeConfig" : {
 | 
			
		||||
      "$ref" : "#/definitions/GLScope"
 | 
			
		||||
    },
 | 
			
		||||
@ -56112,7 +56109,7 @@ except ApiException as e:
 | 
			
		||||
          </div>
 | 
			
		||||
          <div id="generator">
 | 
			
		||||
            <div class="content">
 | 
			
		||||
              Generated 2022-05-27T00:17:01.671+02:00
 | 
			
		||||
              Generated 2022-05-27T09:54:03.529+02:00
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
@ -48,8 +48,6 @@ SWGDOA2Settings::SWGDOA2Settings() {
 | 
			
		||||
    m_reverse_api_device_index_isSet = false;
 | 
			
		||||
    reverse_api_channel_index = 0;
 | 
			
		||||
    m_reverse_api_channel_index_isSet = false;
 | 
			
		||||
    spectrum_config = nullptr;
 | 
			
		||||
    m_spectrum_config_isSet = false;
 | 
			
		||||
    scope_config = nullptr;
 | 
			
		||||
    m_scope_config_isSet = false;
 | 
			
		||||
    channel_marker = nullptr;
 | 
			
		||||
@ -84,8 +82,6 @@ SWGDOA2Settings::init() {
 | 
			
		||||
    m_reverse_api_device_index_isSet = false;
 | 
			
		||||
    reverse_api_channel_index = 0;
 | 
			
		||||
    m_reverse_api_channel_index_isSet = false;
 | 
			
		||||
    spectrum_config = new SWGGLSpectrum();
 | 
			
		||||
    m_spectrum_config_isSet = false;
 | 
			
		||||
    scope_config = new SWGGLScope();
 | 
			
		||||
    m_scope_config_isSet = false;
 | 
			
		||||
    channel_marker = new SWGChannelMarker();
 | 
			
		||||
@ -110,9 +106,6 @@ SWGDOA2Settings::cleanup() {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if(spectrum_config != nullptr) { 
 | 
			
		||||
        delete spectrum_config;
 | 
			
		||||
    }
 | 
			
		||||
    if(scope_config != nullptr) { 
 | 
			
		||||
        delete scope_config;
 | 
			
		||||
    }
 | 
			
		||||
@ -155,8 +148,6 @@ SWGDOA2Settings::fromJsonObject(QJsonObject &pJson) {
 | 
			
		||||
    
 | 
			
		||||
    ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
 | 
			
		||||
    
 | 
			
		||||
    ::SWGSDRangel::setValue(&spectrum_config, pJson["spectrumConfig"], "SWGGLSpectrum", "SWGGLSpectrum");
 | 
			
		||||
    
 | 
			
		||||
    ::SWGSDRangel::setValue(&scope_config, pJson["scopeConfig"], "SWGGLScope", "SWGGLScope");
 | 
			
		||||
    
 | 
			
		||||
    ::SWGSDRangel::setValue(&channel_marker, pJson["channelMarker"], "SWGChannelMarker", "SWGChannelMarker");
 | 
			
		||||
@ -209,9 +200,6 @@ SWGDOA2Settings::asJsonObject() {
 | 
			
		||||
    if(m_reverse_api_channel_index_isSet){
 | 
			
		||||
        obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
 | 
			
		||||
    }
 | 
			
		||||
    if((spectrum_config != nullptr) && (spectrum_config->isSet())){
 | 
			
		||||
        toJsonValue(QString("spectrumConfig"), spectrum_config, obj, QString("SWGGLSpectrum"));
 | 
			
		||||
    }
 | 
			
		||||
    if((scope_config != nullptr) && (scope_config->isSet())){
 | 
			
		||||
        toJsonValue(QString("scopeConfig"), scope_config, obj, QString("SWGGLScope"));
 | 
			
		||||
    }
 | 
			
		||||
@ -325,16 +313,6 @@ SWGDOA2Settings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) {
 | 
			
		||||
    this->m_reverse_api_channel_index_isSet = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SWGGLSpectrum*
 | 
			
		||||
SWGDOA2Settings::getSpectrumConfig() {
 | 
			
		||||
    return spectrum_config;
 | 
			
		||||
}
 | 
			
		||||
void
 | 
			
		||||
SWGDOA2Settings::setSpectrumConfig(SWGGLSpectrum* spectrum_config) {
 | 
			
		||||
    this->spectrum_config = spectrum_config;
 | 
			
		||||
    this->m_spectrum_config_isSet = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SWGGLScope*
 | 
			
		||||
SWGDOA2Settings::getScopeConfig() {
 | 
			
		||||
    return scope_config;
 | 
			
		||||
@ -400,9 +378,6 @@ SWGDOA2Settings::isSet(){
 | 
			
		||||
        if(m_reverse_api_channel_index_isSet){
 | 
			
		||||
            isObjectUpdated = true; break;
 | 
			
		||||
        }
 | 
			
		||||
        if(spectrum_config && spectrum_config->isSet()){
 | 
			
		||||
            isObjectUpdated = true; break;
 | 
			
		||||
        }
 | 
			
		||||
        if(scope_config && scope_config->isSet()){
 | 
			
		||||
            isObjectUpdated = true; break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,6 @@
 | 
			
		||||
 | 
			
		||||
#include "SWGChannelMarker.h"
 | 
			
		||||
#include "SWGGLScope.h"
 | 
			
		||||
#include "SWGGLSpectrum.h"
 | 
			
		||||
#include "SWGRollupState.h"
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
@ -76,9 +75,6 @@ public:
 | 
			
		||||
    qint32 getReverseApiChannelIndex();
 | 
			
		||||
    void setReverseApiChannelIndex(qint32 reverse_api_channel_index);
 | 
			
		||||
 | 
			
		||||
    SWGGLSpectrum* getSpectrumConfig();
 | 
			
		||||
    void setSpectrumConfig(SWGGLSpectrum* spectrum_config);
 | 
			
		||||
 | 
			
		||||
    SWGGLScope* getScopeConfig();
 | 
			
		||||
    void setScopeConfig(SWGGLScope* scope_config);
 | 
			
		||||
 | 
			
		||||
@ -122,9 +118,6 @@ private:
 | 
			
		||||
    qint32 reverse_api_channel_index;
 | 
			
		||||
    bool m_reverse_api_channel_index_isSet;
 | 
			
		||||
 | 
			
		||||
    SWGGLSpectrum* spectrum_config;
 | 
			
		||||
    bool m_spectrum_config_isSet;
 | 
			
		||||
 | 
			
		||||
    SWGGLScope* scope_config;
 | 
			
		||||
    bool m_scope_config_isSet;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user