Spectrum Calibration: implementation of calibration points management

pull/1128/head
f4exb 2022-01-30 07:43:50 +01:00
rodzic 257a1f685e
commit 76c84c55d8
25 zmienionych plików z 1438 dodań i 5 usunięć

Wyświetl plik

@ -151,6 +151,7 @@ set(sdrbase_SOURCES
dsp/devicesamplemimo.cpp
dsp/devicesamplestatic.cpp
dsp/spectrummarkers.cpp
dsp/spectrumcalibrationpoint.cpp
dsp/spectrumvis.cpp
dsp/wavfilerecord.cpp
@ -309,6 +310,7 @@ set(sdrbase_HEADERS
dsp/glscopesettings.h
dsp/glspectruminterface.h
dsp/spectrummarkers.h
dsp/spectrumcalibrationpoint.h
dsp/spectrumsettings.h
dsp/goertzel.h
dsp/hbfilterchainconverter.h

Wyświetl plik

@ -0,0 +1,53 @@
///////////////////////////////////////////////////////////////////////////////////
// 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 "util/simpleserializer.h"
#include "spectrumcalibrationpoint.h"
QByteArray SpectrumCalibrationPoint::serialize() const
{
SimpleSerializer s(1);
s.writeS64(1, m_frequency);
s.writeFloat(2, m_powerRelativeReference);
s.writeFloat(3, m_powerAbsoluteReference);
return s.final();
}
bool SpectrumCalibrationPoint::deserialize(const QByteArray& data)
{
SimpleDeserializer d(data);
if (!d.isValid()) {
return false;
}
if (d.getVersion() == 1)
{
d.readS64(1, &m_frequency, 0);
d.readFloat(2, &m_powerRelativeReference, 1.0f);
d.readFloat(3, &m_powerAbsoluteReference, 1.0f);
return true;
}
else
{
return false;
}
}

Wyświetl plik

@ -0,0 +1,55 @@
///////////////////////////////////////////////////////////////////////////////////
// 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_SPECTRUMCALIBRATIONPOINT_H
#define INCLUDE_SPECTRUMCALIBRATIONPOINT_H
#include <QtGlobal>
#include "export.h"
struct SDRBASE_API SpectrumCalibrationPoint
{
qint64 m_frequency; //!< frequency in Hz
float m_powerRelativeReference; //!< relative power level on 0..1 scale
float m_powerAbsoluteReference; //!< absolute power level in mW
SpectrumCalibrationPoint() :
m_frequency(0),
m_powerRelativeReference(1.0f),
m_powerAbsoluteReference(1.0f)
{}
SpectrumCalibrationPoint(
quint64 frequency,
float powerRelativeReference,
float powerAbsoluteReference
) :
m_frequency(frequency),
m_powerRelativeReference(powerRelativeReference),
m_powerAbsoluteReference(powerAbsoluteReference)
{}
SpectrumCalibrationPoint(const SpectrumCalibrationPoint& other) = default;
SpectrumCalibrationPoint& operator=(const SpectrumCalibrationPoint&) = default;
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
};
#endif // INCLUDE_SPECTRUMCALIBRATIONPOINTs_H

Wyświetl plik

@ -107,11 +107,17 @@ QByteArray SpectrumSettings::serialize() const
s.writeBlob(111+i, m_waterfallMarkers[i].serialize());
}
QByteArray data;
QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
QByteArray dataAnnotation;
QDataStream *stream = new QDataStream(&dataAnnotation, QIODevice::WriteOnly);
(*stream) << m_annoationMarkers;
delete stream;
s.writeBlob(40, data);
s.writeBlob(40, dataAnnotation);
QByteArray dataCalibration;
stream = new QDataStream(&dataCalibration, QIODevice::WriteOnly);
(*stream) << m_calibrationPoints;
delete stream;
s.writeBlob(41, dataCalibration);
return s.final();
}
@ -126,6 +132,14 @@ QDataStream& operator<<(QDataStream& out, const SpectrumAnnotationMarker& marker
return out;
}
QDataStream& operator<<(QDataStream& out, const SpectrumCalibrationPoint& calibrationPoint)
{
out << calibrationPoint.m_frequency;
out << calibrationPoint.m_powerRelativeReference;
out << calibrationPoint.m_powerAbsoluteReference;
return out;
}
bool SpectrumSettings::deserialize(const QByteArray& data)
{
SimpleDeserializer d(data);
@ -210,6 +224,11 @@ bool SpectrumSettings::deserialize(const QByteArray& data)
(*stream) >> m_annoationMarkers;
delete stream;
d.readBlob(41, &bytetmp);
stream = new QDataStream(bytetmp);
(*stream) >> m_calibrationPoints;
delete stream;
return true;
}
else
@ -231,6 +250,14 @@ QDataStream& operator>>(QDataStream& in, SpectrumAnnotationMarker& marker)
return in;
}
QDataStream& operator>>(QDataStream& in, SpectrumCalibrationPoint& calibrationPoint)
{
in >> calibrationPoint.m_frequency;
in >> calibrationPoint.m_powerRelativeReference;
in >> calibrationPoint.m_powerAbsoluteReference;
return in;
}
void SpectrumSettings::formatTo(SWGSDRangel::SWGObject *swgObject) const
{
SWGSDRangel::SWGGLSpectrum *swgSpectrum = static_cast<SWGSDRangel::SWGGLSpectrum *>(swgObject);
@ -311,6 +338,19 @@ void SpectrumSettings::formatTo(SWGSDRangel::SWGObject *swgObject) const
swgSpectrum->getAnnotationMarkers()->back()->setShow((int) marker.m_show);
}
}
if (m_calibrationPoints.size() > 0)
{
swgSpectrum->setCalibrationPoints(new QList<SWGSDRangel::SWGSpectrumCalibrationPoint *>);
for (const auto &calibrationPoint : m_calibrationPoints)
{
swgSpectrum->getCalibrationPoints()->append(new SWGSDRangel::SWGSpectrumCalibrationPoint);
swgSpectrum->getCalibrationPoints()->back()->setFrequency(calibrationPoint.m_frequency);
swgSpectrum->getCalibrationPoints()->back()->setPowerRelativeReference(calibrationPoint.m_powerRelativeReference);
swgSpectrum->getCalibrationPoints()->back()->setPowerAbsoluteReference(calibrationPoint.m_powerAbsoluteReference);
}
}
}
void SpectrumSettings::updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject)
@ -460,6 +500,20 @@ void SpectrumSettings::updateFrom(const QStringList& keys, const SWGSDRangel::SW
m_annoationMarkers.back().m_show = (SpectrumAnnotationMarker::ShowState) swgAnnotationMarker->getShow();
}
}
if (keys.contains("spectrumConfig.calibrationPoints"))
{
QList<SWGSDRangel::SWGSpectrumCalibrationPoint *> *swgCalibrationPoints = swgSpectrum->getCalibrationPoints();
m_calibrationPoints.clear();
for (const auto &swgCalibrationPoint : *swgCalibrationPoints)
{
m_calibrationPoints.push_back(SpectrumCalibrationPoint());
m_calibrationPoints.back().m_frequency = swgCalibrationPoint->getFrequency();
m_calibrationPoints.back().m_powerRelativeReference = swgCalibrationPoint->getPowerRelativeReference();
m_calibrationPoints.back().m_powerAbsoluteReference = swgCalibrationPoint->getPowerAbsoluteReference();
}
}
}
int SpectrumSettings::getAveragingMaxScale(AveragingMode averagingMode)

Wyświetl plik

@ -25,6 +25,7 @@
#include "dsp/dsptypes.h"
#include "dsp/fftwindow.h"
#include "dsp/spectrummarkers.h"
#include "dsp/spectrumcalibrationpoint.h"
#include "settings/serializable.h"
class SDRBASE_API SpectrumSettings : public Serializable
@ -76,6 +77,7 @@ public:
QList<SpectrumWaterfallMarker> m_waterfallMarkers;
QList<SpectrumAnnotationMarker> m_annoationMarkers;
MarkersDisplay m_markersDisplay;
QList<SpectrumCalibrationPoint> m_calibrationPoints;
static const int m_log2FFTSizeMin = 6; // 64
static const int m_log2FFTSizeMax = 15; // 32k

Wyświetl plik

@ -6172,6 +6172,12 @@ margin-bottom: 20px;
"items" : {
"$ref" : "#/definitions/SpectrumAnnotationMarker"
}
},
"calibrationPoints" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/SpectrumCalibrationPoint"
}
}
},
"description" : "GLSpectrumGUI settings"
@ -11812,6 +11818,23 @@ margin-bottom: 20px;
}
},
"description" : "Spectrum annotation marker settings"
};
defs.SpectrumCalibrationPoint = {
"properties" : {
"frequency" : {
"type" : "integer",
"format" : "int64"
},
"powerRelativeReference" : {
"type" : "number",
"format" : "float"
},
"powerAbsoluteReference" : {
"type" : "number",
"format" : "float"
}
},
"description" : "Spectrum calibration point settings"
};
defs.SpectrumHistogramMarker = {
"properties" : {
@ -51973,7 +51996,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-01-22T07:01:26.727+01:00
Generated 2022-01-29T10:45:16.003+01:00
</div>
</div>
</div>

Wyświetl plik

@ -64,6 +64,19 @@ SpectrumAnnotationMarker:
* 1 - Only top marker visible
* 2 - Fully visible with text and full sized limits
SpectrumCalibrationPoint:
description: Spectrum calibration point settings
properties:
frequency:
type: integer
format: int64
powerRelativeReference:
type: number
format: float
powerAbsoluteReference:
type: number
format: float
GLSpectrum:
description: GLSpectrumGUI settings
properties:
@ -159,3 +172,7 @@ GLSpectrum:
type: array
items:
$ref: "/doc/swagger/include/GLSpectrum.yaml#/SpectrumAnnotationMarker"
calibrationPoints:
type: array
items:
$ref: "/doc/swagger/include/GLSpectrum.yaml#/SpectrumCalibrationPoint"

Wyświetl plik

@ -59,6 +59,7 @@ set(sdrgui_SOURCES
gui/scaleengine.cpp
gui/scaledimage.cpp
gui/sdrangelsplash.cpp
gui/spectrumcalibrationpointsdialog.cpp
gui/spectrummarkersdialog.cpp
gui/tickedslider.cpp
gui/transverterbutton.cpp
@ -148,6 +149,7 @@ set(sdrgui_HEADERS
gui/scaleengine.h
gui/scaledimage.h
gui/sdrangelsplash.h
gui/spectrumcalibrationpointsdialog.h
gui/spectrummarkersdialog.h
gui/tickedslider.h
gui/transverterbutton.h
@ -208,6 +210,7 @@ set(sdrgui_FORMS
gui/samplingdevicecontrol.ui
gui/samplingdevicedialog.ui
gui/spectrummarkersdialog.ui
gui/spectrumcalibrationpointsdialog.ui
gui/myposdialog.ui
gui/transverterdialog.ui
gui/loggingdialog.ui

Wyświetl plik

@ -2314,6 +2314,11 @@ void GLSpectrum::updateMarkersDisplay()
}
}
void GLSpectrum::updateCalibrationPoints()
{
// TODO
}
void GLSpectrum::mouseMoveEvent(QMouseEvent* event)
{
if (m_displayWaterfall || m_displayHistogram || m_displayMaxHold || m_displayCurrent)

Wyświetl plik

@ -168,6 +168,7 @@ public:
void updateWaterfallMarkers();
void updateAnnotationMarkers();
void updateMarkersDisplay();
void updateCalibrationPoints();
SpectrumSettings::MarkersDisplay& getMarkersDisplay() { return m_markersDisplay; }
void setMarkersDisplay(SpectrumSettings::MarkersDisplay markersDisplay);

Wyświetl plik

@ -29,6 +29,7 @@
#include "gui/crightclickenabler.h"
#include "gui/wsspectrumsettingsdialog.h"
#include "gui/spectrummarkersdialog.h"
#include "gui/spectrumcalibrationpointsdialog.h"
#include "util/simpleserializer.h"
#include "util/db.h"
#include "ui_glspectrumgui.h"
@ -64,6 +65,9 @@ GLSpectrumGUI::GLSpectrumGUI(QWidget* parent) :
CRightClickEnabler *wsSpectrumRightClickEnabler = new CRightClickEnabler(ui->wsSpectrum);
connect(wsSpectrumRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openWebsocketSpectrumSettingsDialog(const QPoint &)));
CRightClickEnabler *calibrationPointsRightClickEnabler = new CRightClickEnabler(ui->calibration);
connect(calibrationPointsRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openCalibrationPointsDialog(const QPoint &)));
displaySettings();
setAveragingCombo();
applySettings();
@ -726,6 +730,27 @@ void GLSpectrumGUI::openWebsocketSpectrumSettingsDialog(const QPoint& p)
}
}
void GLSpectrumGUI::openCalibrationPointsDialog(const QPoint& p)
{
SpectrumCalibrationPointsDialog dialog(
m_settings.m_calibrationPoints,
m_glSpectrum->getHistogramMarkers().size() > 0 ? &m_glSpectrum->getHistogramMarkers()[0] : nullptr,
this
);
dialog.setCenterFrequency(m_glSpectrum->getCenterFrequency());
connect(&dialog, SIGNAL(updateCalibrationPoints()), this, SLOT(updateCalibrationPoints()));
dialog.move(p);
dialog.exec();
m_settings.m_histogramMarkers = m_glSpectrum->getHistogramMarkers();
m_settings.m_waterfallMarkers = m_glSpectrum->getWaterfallMarkers();
m_settings.m_annoationMarkers = m_glSpectrum->getAnnotationMarkers();
m_settings.m_markersDisplay = m_glSpectrum->getMarkersDisplay();
applySettings();
}
void GLSpectrumGUI::updateHistogramMarkers()
{
if (m_glSpectrum) {
@ -753,3 +778,10 @@ void GLSpectrumGUI::updateMarkersDisplay()
m_glSpectrum->updateMarkersDisplay();
}
}
void GLSpectrumGUI::updateCalibrationPoints()
{
if (m_glSpectrum) {
m_glSpectrum->updateCalibrationPoints();
}
}

Wyświetl plik

@ -114,11 +114,13 @@ private slots:
void handleInputMessages();
void openWebsocketSpectrumSettingsDialog(const QPoint& p);
void openCalibrationPointsDialog(const QPoint& p);
void updateHistogramMarkers();
void updateWaterfallMarkers();
void updateAnnotationMarkers();
void updateMarkersDisplay();
void updateCalibrationPoints();
};
#endif // INCLUDE_GLSPECTRUMGUI_H

Wyświetl plik

@ -568,6 +568,20 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="calibration">
<property name="toolTip">
<string>Left: toggle relative / mW units - Right: open calibration dialog</string>
</property>
<property name="icon">
<iconset resource="../resources/res.qrc">
<normaloff>:/ruler.png</normaloff>:/ruler.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">

Wyświetl plik

@ -0,0 +1,278 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2022 F4EXB //
// written by Edouard Griffiths //
// //
// 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 <QFileDialog>
#include <QFile>
#include <QStandardPaths>
#include "util/db.h"
#include "util/csv.h"
#include "dsp/spectrummarkers.h"
#include "spectrumcalibrationpointsdialog.h"
#include "ui_spectrumcalibrationpointsdialog.h"
SpectrumCalibrationPointsDialog::SpectrumCalibrationPointsDialog(
QList<SpectrumCalibrationPoint>& calibrationPoints,
const SpectrumHistogramMarker *markerZero,
QWidget* parent) :
QDialog(parent),
ui(new Ui::SpectrumCalibrationPointsDialog),
m_calibrationPoints(calibrationPoints),
m_markerZero(markerZero),
m_calibrationPointIndex(0),
m_centerFrequency(0)
{
ui->setupUi(this);
ui->calibPointFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->calibPointFrequency->setValueRange(false, 10, -9999999999L, 9999999999L);
ui->calibPoint->setMaximum(m_calibrationPoints.size() - 1);
displayCalibrationPoint();
}
SpectrumCalibrationPointsDialog::~SpectrumCalibrationPointsDialog()
{}
void SpectrumCalibrationPointsDialog::displayCalibrationPoint()
{
ui->calibPointFrequency->blockSignals(true);
ui->calibPoint->blockSignals(true);
ui->relativePower->blockSignals(true);
ui->absolutePower->blockSignals(true);
if (m_calibrationPoints.size() == 0)
{
ui->calibPoint->setEnabled(false);
ui->calibPointDel->setEnabled(false);
ui->relativePower->setEnabled(false);
ui->absolutePower->setEnabled(false);
ui->calibPointFrequency->setEnabled(false);
ui->importMarkerZero->setEnabled(false);
ui->centerFrequency->setEnabled(false);
}
else
{
ui->calibPoint->setEnabled(true);
ui->calibPointDel->setEnabled(true);
ui->relativePower->setEnabled(true);
ui->absolutePower->setEnabled(true);
ui->calibPointFrequency->setEnabled(true);
ui->importMarkerZero->setEnabled(true);
ui->centerFrequency->setEnabled(true);
ui->calibPoint->setValue(m_calibrationPointIndex);
ui->calibPointText->setText(tr("%1").arg(m_calibrationPointIndex));
float powerDB = CalcDb::dbPower(m_calibrationPoints[m_calibrationPointIndex].m_powerRelativeReference);
ui->relativePower->setValue(powerDB*10);
ui->relativePowerText->setText(QString::number(powerDB, 'f', 1));
powerDB = CalcDb::dbPower(m_calibrationPoints[m_calibrationPointIndex].m_powerAbsoluteReference);
ui->absolutePower->setValue(powerDB*10);
ui->absolutePowerText->setText(QString::number(powerDB, 'f', 1));
ui->calibPointFrequency->setValue(m_calibrationPoints[m_calibrationPointIndex].m_frequency);
}
ui->calibPointFrequency->blockSignals(false);
ui->calibPoint->blockSignals(false);
ui->relativePower->blockSignals(false);
ui->absolutePower->blockSignals(false);
}
void SpectrumCalibrationPointsDialog::on_calibPoint_valueChanged(int value)
{
if (m_calibrationPoints.size() == 0) {
return;
}
m_calibrationPointIndex = value;
displayCalibrationPoint();
}
void SpectrumCalibrationPointsDialog::on_calibPointAdd_clicked()
{
m_calibrationPoints.append(SpectrumCalibrationPoint());
m_calibrationPoints.back().m_frequency = m_centerFrequency;
m_calibrationPointIndex = m_calibrationPoints.size() - 1;
ui->calibPoint->setMaximum(m_calibrationPoints.size() - 1);
ui->calibPoint->setMinimum(0);
displayCalibrationPoint();
}
void SpectrumCalibrationPointsDialog::on_calibPointDel_clicked()
{
if (m_calibrationPoints.size() == 0) {
return;
}
m_calibrationPoints.removeAt(m_calibrationPointIndex);
m_calibrationPointIndex = m_calibrationPointIndex < m_calibrationPoints.size() ?
m_calibrationPointIndex : m_calibrationPointIndex - 1;
ui->calibPoint->setMaximum(m_calibrationPoints.size() - 1);
ui->calibPoint->setMinimum(0);
displayCalibrationPoint();
}
void SpectrumCalibrationPointsDialog::on_relativePower_valueChanged(int value)
{
if (m_calibrationPoints.size() == 0) {
return;
}
float powerDB = value / 10.0f;
ui->relativePowerText->setText(QString::number(powerDB, 'f', 1));
m_calibrationPoints[m_calibrationPointIndex].m_powerRelativeReference = CalcDb::powerFromdB(powerDB);
emit updateCalibrationPoints();
}
void SpectrumCalibrationPointsDialog::on_absolutePower_valueChanged(int value)
{
if (m_calibrationPoints.size() == 0) {
return;
}
float powerDB = value / 10.0f;
ui->absolutePowerText->setText(QString::number(powerDB, 'f', 1));
m_calibrationPoints[m_calibrationPointIndex].m_powerAbsoluteReference = CalcDb::powerFromdB(powerDB);
emit updateCalibrationPoints();
}
void SpectrumCalibrationPointsDialog::on_calibPointFrequency_changed(qint64 value)
{
if (m_calibrationPoints.size() == 0) {
return;
}
m_calibrationPoints[m_calibrationPointIndex].m_frequency = value;
emit updateCalibrationPoints();
}
void SpectrumCalibrationPointsDialog::on_importMarkerZero_clicked()
{
if ((m_calibrationPoints.size() == 0) || (m_markerZero == nullptr)) {
return;
}
m_calibrationPoints[m_calibrationPointIndex].m_frequency = m_markerZero->m_frequency;
m_calibrationPoints[m_calibrationPointIndex].m_powerRelativeReference = CalcDb::powerFromdB(m_markerZero->m_powerMax);
displayCalibrationPoint();
emit updateCalibrationPoints();
}
void SpectrumCalibrationPointsDialog::on_centerFrequency_clicked()
{
if (m_calibrationPoints.size() == 0) {
return;
}
m_calibrationPoints[m_calibrationPointIndex].m_frequency = m_centerFrequency;
displayCalibrationPoint();
emit updateCalibrationPoints();
}
void SpectrumCalibrationPointsDialog::on_calibPointsExport_clicked()
{
QFileDialog fileDialog(
nullptr,
"Select file to write calibration points to",
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation),
"*.csv"
);
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
if (fileDialog.exec())
{
QStringList fileNames = fileDialog.selectedFiles();
if (fileNames.size() > 0)
{
QFile file(fileNames[0]);
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
{
QTextStream stream;
stream.setDevice(&file);
stream << "Frequency,Reference,Absolute\n";
for (const auto &calibrationPint : m_calibrationPoints)
{
stream << calibrationPint.m_frequency << ","
<< calibrationPint.m_powerRelativeReference << ","
<< calibrationPint.m_powerAbsoluteReference << "\n";
}
stream.flush();
file.close();
}
}
}
}
void SpectrumCalibrationPointsDialog::on_calibPointsImport_clicked()
{
QFileDialog fileDialog(
nullptr,
"Select .csv calibration points file to read",
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation),
"*.csv"
);
if (fileDialog.exec())
{
QStringList fileNames = fileDialog.selectedFiles();
if (fileNames.size() > 0)
{
QFile file(fileNames[0]);
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream in(&file);
QString error;
QHash<QString, int> colIndexes = CSV::readHeader(
in,
{"Frequency", "Reference", "Absolute"},
error
);
if (error.isEmpty())
{
QStringList cols;
int frequencyCol = colIndexes.value("Frequency");
int referenceCol = colIndexes.value("Reference");
int absoluteCol = colIndexes.value("Absolute");
m_calibrationPoints.clear();
while (CSV::readRow(in, &cols))
{
m_calibrationPoints.push_back(SpectrumCalibrationPoint());
m_calibrationPoints.back().m_frequency = cols[frequencyCol].toLongLong();
m_calibrationPoints.back().m_powerRelativeReference = cols[referenceCol].toFloat();
m_calibrationPoints.back().m_powerAbsoluteReference = cols[absoluteCol].toFloat();
}
m_calibrationPointIndex = 0;
ui->calibPoint->setMaximum(m_calibrationPoints.size() - 1);
ui->calibPoint->setMinimum(0);
displayCalibrationPoint();
emit updateCalibrationPoints();
}
}
}
}
}

Wyświetl plik

@ -0,0 +1,72 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2022 F4EXB //
// written by Edouard Griffiths //
// //
// 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 SDRBASE_GUI_SPECTRUMCALIBRATIONPOINTSDIALOG_H_
#define SDRBASE_GUI_SPECTRUMCALIBRATIONPOINTSDIALOG_H_
#include <QDialog>
#include <QList>
#include "dsp/spectrumsettings.h"
#include "dsp/spectrumcalibrationpoint.h"
#include "export.h"
class SpectrumHistogramMarker;
namespace Ui {
class SpectrumCalibrationPointsDialog;
}
class SDRGUI_API SpectrumCalibrationPointsDialog : public QDialog {
Q_OBJECT
public:
explicit SpectrumCalibrationPointsDialog(
QList<SpectrumCalibrationPoint>& calibrationPoints,
const SpectrumHistogramMarker *markerZero,
QWidget* parent = nullptr
);
~SpectrumCalibrationPointsDialog();
void setCenterFrequency(qint64 centerFrequency) { m_centerFrequency = centerFrequency; }
private:
Ui::SpectrumCalibrationPointsDialog* ui;
QList<SpectrumCalibrationPoint>& m_calibrationPoints;
const SpectrumHistogramMarker *m_markerZero;
int m_calibrationPointIndex;
qint64 m_centerFrequency;
void displayCalibrationPoint();
private slots:
void on_calibPoint_valueChanged(int value);
void on_calibPointAdd_clicked();
void on_calibPointDel_clicked();
void on_relativePower_valueChanged(int value);
void on_absolutePower_valueChanged(int value);
void on_calibPointFrequency_changed(qint64 value);
void on_importMarkerZero_clicked();
void on_centerFrequency_clicked();
void on_calibPointsExport_clicked();
void on_calibPointsImport_clicked();
signals:
void updateCalibrationPoints();
};
#endif // SDRBASE_GUI_SPECTRUMCALIBRATIONPOINTSDIALOG_H_

Wyświetl plik

@ -0,0 +1,513 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SpectrumCalibrationPointsDialog</class>
<widget class="QDialog" name="SpectrumCalibrationPointsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>131</height>
</rect>
</property>
<property name="windowTitle">
<string>Spectrum Calibration Points</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="CalibrationPointLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="CalibPointOptionsLayout">
<item>
<widget class="QLabel" name="calibPointLabel">
<property name="minimumSize">
<size>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Pt</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="calibPointText">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="calibPoint">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Calibration point index</string>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="calibPointAddRemoveLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="calibPointAdd">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Add a new calibration point</string>
</property>
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="calibPointDel">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Remove current calibration point</string>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="relativePowerLabel">
<property name="minimumSize">
<size>
<width>15</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>R</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="relativePower">
<property name="toolTip">
<string>Relative power (dB)</string>
</property>
<property name="minimum">
<number>-1500</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>-200</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="relativePowerText">
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>-100.0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="absolutePowerLabel">
<property name="minimumSize">
<size>
<width>15</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>A</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="absolutePower">
<property name="toolTip">
<string>Absolute power (dBm)</string>
</property>
<property name="minimum">
<number>-1500</number>
</property>
<property name="maximum">
<number>400</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="absolutePowerText">
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>-100.0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="CalibPointPosLayout">
<item>
<widget class="QLabel" name="calibPointFrequencyLabel">
<property name="text">
<string>F</string>
</property>
</widget>
</item>
<item>
<widget class="ValueDialZ" name="calibPointFrequency" 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>DejaVu Sans 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>Calibration point frequency (Hz)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="calibPointFrequencyUnits">
<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="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Marker frequency (Hz)</string>
</property>
<property name="text">
<string>Hz</string>
</property>
</widget>
</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="QPushButton" name="importMarkerZero">
<property name="maximumSize">
<size>
<width>30</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Import data from histogram marker 0</string>
</property>
<property name="text">
<string>M0</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="centerFrequency">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Set calibration point frequency to center frequency</string>
</property>
<property name="text">
<string>C</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="calibPointsExport">
<property name="toolTip">
<string>Export calibration points to .csv file</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/res.qrc">
<normaloff>:/export.png</normaloff>:/export.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="calibPointsImport">
<property name="toolTip">
<string>Import calibration points from .csv file</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/res.qrc">
<normaloff>:/import.png</normaloff>:/import.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../resources/res.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SpectrumCalibrationPointsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SpectrumCalibrationPointsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Wyświetl plik

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>ruler.png</file>
<file>sort.png</file>
<file>audio_mic.png</file>
<file>info.png</file>

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 975 B

Wyświetl plik

@ -64,6 +64,19 @@ SpectrumAnnotationMarker:
* 1 - Only top marker visible
* 2 - Fully visible with text and full sized limits
SpectrumCalibrationPoint:
description: Spectrum calibration point settings
properties:
frequency:
type: integer
format: int64
powerRelativeReference:
type: number
format: float
powerAbsoluteReference:
type: number
format: float
GLSpectrum:
description: GLSpectrumGUI settings
properties:
@ -159,3 +172,7 @@ GLSpectrum:
type: array
items:
$ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/SpectrumAnnotationMarker"
calibrationPoints:
type: array
items:
$ref: "http://swgserver:8081/api/swagger/include/GLSpectrum.yaml#/SpectrumCalibrationPoint"

Wyświetl plik

@ -6172,6 +6172,12 @@ margin-bottom: 20px;
"items" : {
"$ref" : "#/definitions/SpectrumAnnotationMarker"
}
},
"calibrationPoints" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/SpectrumCalibrationPoint"
}
}
},
"description" : "GLSpectrumGUI settings"
@ -11812,6 +11818,23 @@ margin-bottom: 20px;
}
},
"description" : "Spectrum annotation marker settings"
};
defs.SpectrumCalibrationPoint = {
"properties" : {
"frequency" : {
"type" : "integer",
"format" : "int64"
},
"powerRelativeReference" : {
"type" : "number",
"format" : "float"
},
"powerAbsoluteReference" : {
"type" : "number",
"format" : "float"
}
},
"description" : "Spectrum calibration point settings"
};
defs.SpectrumHistogramMarker = {
"properties" : {
@ -51973,7 +51996,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-01-22T07:01:26.727+01:00
Generated 2022-01-29T10:45:16.003+01:00
</div>
</div>
</div>

Wyświetl plik

@ -88,6 +88,8 @@ SWGGLSpectrum::SWGGLSpectrum() {
m_waterfall_markers_isSet = false;
annotation_markers = nullptr;
m_annotation_markers_isSet = false;
calibration_points = nullptr;
m_calibration_points_isSet = false;
}
SWGGLSpectrum::~SWGGLSpectrum() {
@ -156,6 +158,8 @@ SWGGLSpectrum::init() {
m_waterfall_markers_isSet = false;
annotation_markers = new QList<SWGSpectrumAnnotationMarker*>();
m_annotation_markers_isSet = false;
calibration_points = new QList<SWGSpectrumCalibrationPoint*>();
m_calibration_points_isSet = false;
}
void
@ -210,6 +214,13 @@ SWGGLSpectrum::cleanup() {
}
delete annotation_markers;
}
if(calibration_points != nullptr) {
auto arr = calibration_points;
for(auto o: *arr) {
delete o;
}
delete calibration_points;
}
}
SWGGLSpectrum*
@ -283,6 +294,8 @@ SWGGLSpectrum::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&waterfall_markers, pJson["waterfallMarkers"], "QList", "SWGSpectrumWaterfallMarker");
::SWGSDRangel::setValue(&annotation_markers, pJson["annotationMarkers"], "QList", "SWGSpectrumAnnotationMarker");
::SWGSDRangel::setValue(&calibration_points, pJson["calibrationPoints"], "QList", "SWGSpectrumCalibrationPoint");
}
QString
@ -389,6 +402,9 @@ SWGGLSpectrum::asJsonObject() {
if(annotation_markers && annotation_markers->size() > 0){
toJsonArray((QList<void*>*)annotation_markers, obj, "annotationMarkers", "SWGSpectrumAnnotationMarker");
}
if(calibration_points && calibration_points->size() > 0){
toJsonArray((QList<void*>*)calibration_points, obj, "calibrationPoints", "SWGSpectrumCalibrationPoint");
}
return obj;
}
@ -693,6 +709,16 @@ SWGGLSpectrum::setAnnotationMarkers(QList<SWGSpectrumAnnotationMarker*>* annotat
this->m_annotation_markers_isSet = true;
}
QList<SWGSpectrumCalibrationPoint*>*
SWGGLSpectrum::getCalibrationPoints() {
return calibration_points;
}
void
SWGGLSpectrum::setCalibrationPoints(QList<SWGSpectrumCalibrationPoint*>* calibration_points) {
this->calibration_points = calibration_points;
this->m_calibration_points_isSet = true;
}
bool
SWGGLSpectrum::isSet(){
@ -788,6 +814,9 @@ SWGGLSpectrum::isSet(){
if(annotation_markers && (annotation_markers->size() > 0)){
isObjectUpdated = true; break;
}
if(calibration_points && (calibration_points->size() > 0)){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}

Wyświetl plik

@ -23,6 +23,7 @@
#include "SWGSpectrumAnnotationMarker.h"
#include "SWGSpectrumCalibrationPoint.h"
#include "SWGSpectrumHistogramMarker.h"
#include "SWGSpectrumWaterfallMarker.h"
#include <QList>
@ -136,6 +137,9 @@ public:
QList<SWGSpectrumAnnotationMarker*>* getAnnotationMarkers();
void setAnnotationMarkers(QList<SWGSpectrumAnnotationMarker*>* annotation_markers);
QList<SWGSpectrumCalibrationPoint*>* getCalibrationPoints();
void setCalibrationPoints(QList<SWGSpectrumCalibrationPoint*>* calibration_points);
virtual bool isSet() override;
@ -230,6 +234,9 @@ private:
QList<SWGSpectrumAnnotationMarker*>* annotation_markers;
bool m_annotation_markers_isSet;
QList<SWGSpectrumCalibrationPoint*>* calibration_points;
bool m_calibration_points_isSet;
};
}

Wyświetl plik

@ -266,6 +266,7 @@
#include "SWGSoapySDROutputSettings.h"
#include "SWGSoapySDRReport.h"
#include "SWGSpectrumAnnotationMarker.h"
#include "SWGSpectrumCalibrationPoint.h"
#include "SWGSpectrumHistogramMarker.h"
#include "SWGSpectrumServer.h"
#include "SWGSpectrumServer_clients.h"
@ -1576,6 +1577,11 @@ namespace SWGSDRangel {
obj->init();
return obj;
}
if(QString("SWGSpectrumCalibrationPoint").compare(type) == 0) {
SWGSpectrumCalibrationPoint *obj = new SWGSpectrumCalibrationPoint();
obj->init();
return obj;
}
if(QString("SWGSpectrumHistogramMarker").compare(type) == 0) {
SWGSpectrumHistogramMarker *obj = new SWGSpectrumHistogramMarker();
obj->init();

Wyświetl plik

@ -0,0 +1,154 @@
/**
* 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: 6.0.0
* 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 "SWGSpectrumCalibrationPoint.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSpectrumCalibrationPoint::SWGSpectrumCalibrationPoint(QString* json) {
init();
this->fromJson(*json);
}
SWGSpectrumCalibrationPoint::SWGSpectrumCalibrationPoint() {
frequency = 0L;
m_frequency_isSet = false;
power_relative_reference = 0.0f;
m_power_relative_reference_isSet = false;
power_absolute_reference = 0.0f;
m_power_absolute_reference_isSet = false;
}
SWGSpectrumCalibrationPoint::~SWGSpectrumCalibrationPoint() {
this->cleanup();
}
void
SWGSpectrumCalibrationPoint::init() {
frequency = 0L;
m_frequency_isSet = false;
power_relative_reference = 0.0f;
m_power_relative_reference_isSet = false;
power_absolute_reference = 0.0f;
m_power_absolute_reference_isSet = false;
}
void
SWGSpectrumCalibrationPoint::cleanup() {
}
SWGSpectrumCalibrationPoint*
SWGSpectrumCalibrationPoint::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSpectrumCalibrationPoint::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&frequency, pJson["frequency"], "qint64", "");
::SWGSDRangel::setValue(&power_relative_reference, pJson["powerRelativeReference"], "float", "");
::SWGSDRangel::setValue(&power_absolute_reference, pJson["powerAbsoluteReference"], "float", "");
}
QString
SWGSpectrumCalibrationPoint::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGSpectrumCalibrationPoint::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_frequency_isSet){
obj->insert("frequency", QJsonValue(frequency));
}
if(m_power_relative_reference_isSet){
obj->insert("powerRelativeReference", QJsonValue(power_relative_reference));
}
if(m_power_absolute_reference_isSet){
obj->insert("powerAbsoluteReference", QJsonValue(power_absolute_reference));
}
return obj;
}
qint64
SWGSpectrumCalibrationPoint::getFrequency() {
return frequency;
}
void
SWGSpectrumCalibrationPoint::setFrequency(qint64 frequency) {
this->frequency = frequency;
this->m_frequency_isSet = true;
}
float
SWGSpectrumCalibrationPoint::getPowerRelativeReference() {
return power_relative_reference;
}
void
SWGSpectrumCalibrationPoint::setPowerRelativeReference(float power_relative_reference) {
this->power_relative_reference = power_relative_reference;
this->m_power_relative_reference_isSet = true;
}
float
SWGSpectrumCalibrationPoint::getPowerAbsoluteReference() {
return power_absolute_reference;
}
void
SWGSpectrumCalibrationPoint::setPowerAbsoluteReference(float power_absolute_reference) {
this->power_absolute_reference = power_absolute_reference;
this->m_power_absolute_reference_isSet = true;
}
bool
SWGSpectrumCalibrationPoint::isSet(){
bool isObjectUpdated = false;
do{
if(m_frequency_isSet){
isObjectUpdated = true; break;
}
if(m_power_relative_reference_isSet){
isObjectUpdated = true; break;
}
if(m_power_absolute_reference_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

Wyświetl plik

@ -0,0 +1,70 @@
/**
* 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: 6.0.0
* 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.
*/
/*
* SWGSpectrumCalibrationPoint.h
*
* Spectrum calibration point settings
*/
#ifndef SWGSpectrumCalibrationPoint_H_
#define SWGSpectrumCalibrationPoint_H_
#include <QJsonObject>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGSpectrumCalibrationPoint: public SWGObject {
public:
SWGSpectrumCalibrationPoint();
SWGSpectrumCalibrationPoint(QString* json);
virtual ~SWGSpectrumCalibrationPoint();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSpectrumCalibrationPoint* fromJson(QString &jsonString) override;
qint64 getFrequency();
void setFrequency(qint64 frequency);
float getPowerRelativeReference();
void setPowerRelativeReference(float power_relative_reference);
float getPowerAbsoluteReference();
void setPowerAbsoluteReference(float power_absolute_reference);
virtual bool isSet() override;
private:
qint64 frequency;
bool m_frequency_isSet;
float power_relative_reference;
bool m_power_relative_reference_isSet;
float power_absolute_reference;
bool m_power_absolute_reference_isSet;
};
}
#endif /* SWGSpectrumCalibrationPoint_H_ */