Add SDRplay V3 API sample source.

pull/839/head
Jon Beniston 2021-04-11 21:21:36 +01:00
rodzic c5ece265e9
commit 7aebff1082
36 zmienionych plików z 5282 dodań i 13 usunięć

Wyświetl plik

@ -39,6 +39,7 @@ option(ENABLE_LIMESUITE "Enable limesuite support" ON)
option(ENABLE_MIRISDR "Enable LibMiri for old SDRPlay" ON)
option(ENABLE_PERSEUS "Enable perseus support" ON)
option(ENABLE_RTLSDR "Enable rtl-sdr support" ON)
option(ENABLE_SDRPLAY "Enable SDRplay support" ON)
option(ENABLE_SOAPYSDR "Enable SoapySDR support" ON)
option(ENABLE_XTRX "Enable XTRX support" ON)
option(ENABLE_PACK_MIRSDRAPI "Enable inclusion of the mirsdr-api library - for personal use only" OFF)
@ -82,7 +83,7 @@ add_definitions("-DSDRANGEL_VERSION=\"${sdrangel_VERSION}\"")
# configure CPACK information
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay, USRP and FunCube")
set(CPACK_PACKAGE_VENDOR "${COMPANY}")
set(CPACK_PACKAGE_CONTACT "https://github.com/f4exb/sdrangel")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/Readme.md")
@ -249,6 +250,11 @@ elseif (WIN32)
# LimeSuite FX3 support
set(FX3SDK_DIR "${EXTERNAL_LIBRARY_FOLDER}/FX3SDK" CACHE INTERNAL "")
set(SDRPLAY_FOUND ON CACHE INTERNAL "")
set(SDRPLAY_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/sdrplay/inc" CACHE INTERNAL "")
set(SDRPLAY_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/sdrplay/x64/sdrplay_api.lib" CACHE INTERNAL "")
set(SDRPLAY_DLL_DIR "${EXTERNAL_LIBRARY_FOLDER}/sdrplay/x64/" CACHE INTERNAL "")
# used on fixup_bundle phase
set(WINDOWS_FIXUP_BUNDLE_LIB_DIRS
"${EXTERNAL_LIBRARY_FOLDER}/fftw-3"
@ -403,6 +409,9 @@ endif()
if(ENABLE_RTLSDR)
find_package(LibRTLSDR)
endif()
if(ENABLE_SDRPLAY)
find_package(SDRplay)
endif()
if(ENABLE_SOAPYSDR)
find_package(SoapySDR)
endif()

Wyświetl plik

@ -0,0 +1,27 @@
IF(NOT SDRPLAY_FOUND)
FIND_PATH(
SDRPLAY_INCLUDE_DIR
NAMES sdrplay_api.h
HINTS ${SDRPLAY_DIR}/inc
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
SDRPLAY_LIBRARIES
NAMES sdrplay_api
HINTS ${SDRPLAY_DIR}/x86_64
PATHS /usr/local/lib
/usr/lib
/usr/lib64
)
message(STATUS "SDRPLAY LIBRARIES " ${SDRPLAY_LIBRARIES})
message(STATUS "SDRPLAY INCLUDE DIRS " ${SDRPLAY_INCLUDE_DIR})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDRPLAY DEFAULT_MSG SDRPLAY_LIBRARIES SDRPLAY_INCLUDE_DIR)
MARK_AS_ADVANCED(SDRPLAY_LIBRARIES SDRPLAY_INCLUDE_DIR)
ENDIF(NOT SDRPLAY_FOUND)

Wyświetl plik

@ -225,6 +225,16 @@ elseif(WIN32 OR MINGW)
endforeach(uhd_dll)
endif()
if(ENABLE_SDRPLAY AND SDRPLAY_FOUND)
file(GLOB SDRPLAY_DLLS "${SDRPLAY_DLL_DIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}")
foreach(sdrplay_dll ${SDRPLAY_DLLS})
get_filename_component(sdrplay_dll_name "${sdrplay_dll}" NAME)
add_custom_target(copy_sdrplay_${sdrplay_dll_name} ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${sdrplay_dll}" "${SDRANGEL_BINARY_BIN_DIR}/"
)
endforeach(sdrplay_dll)
endif()
file(GLOB OPENSSL_DLLS "${OPENSSL_DLL_DIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}")
foreach(openssl_dll ${OPENSSL_DLLS})
get_filename_component(openssl_dll_name "${openssl_dll}" NAME)
@ -277,6 +287,9 @@ elseif(WIN32 OR MINGW)
# uhd
install(DIRECTORY "${UHD_DLL_DIR}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}")
# sdrplay
install(DIRECTORY "${SDRPLAY_DLL_DIR}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}")
# OpenSSL
install(DIRECTORY "${OPENSSL_DLL_DIR}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}")

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 12 KiB

Wyświetl plik

@ -19,6 +19,7 @@ set(LIBIIO_TAG 826563e41b5ce9890b75506f672017de8d76d52d)
set(AIRSPYHF_TAG "1.1.5")
set(PERSEUS_TAG afefa23e3140ac79d845acb68cf0beeb86d09028)
set(MIRISDR_TAG "v1.1.2")
set(SDRPLAY_TAG "3.07")
set(PTHREADS4W_TAG "Version-2-11-0-release")
set(RTLSDR_TAG be1d1206bfb6e6c41f7d91b20b77e20f929fa6a7)
@ -590,6 +591,24 @@ if (LINUX)
)
endif (NOT LIBMIRISDR_FOUND OR LIBMIRISDR_EXTERNAL)
if (NOT SDRPLAY_FOUND OR SDRPLAY_EXTERNAL)
set(SDRPLAY_FOUND ON CACHE INTERNAL "")
set(SDRPLAY_EXTERNAL ON CACHE INTERNAL "")
set(SDRPLAY_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/sdrplayapi/inc" CACHE INTERNAL "")
set(SDRPLAY_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/sdrplayapi/x86_64/libsdrplay_api.so.3.07" CACHE INTERNAL "")
ExternalProject_Add(sdrplayapi
GIT_REPOSITORY https://github.com/srcejon/sdrplayapi.git
GIT_TAG ${SDRPLAY_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/sdrplayapi"
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
BUILD_BYPRODUCTS ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
endif (NOT SDRPLAY_FOUND OR SDRPLAY_EXTERNAL)
endif (LINUX)
if (WIN32 OR APPLE)

Wyświetl plik

@ -38,6 +38,10 @@ if(ENABLE_MIRISDR AND LIBMIRISDR_FOUND)
add_subdirectory(sdrplay)
endif()
if(ENABLE_SDRPLAY AND SDRPLAY_FOUND)
add_subdirectory(sdrplayv3)
endif()
if(ENABLE_PERSEUS AND LIBPERSEUS_FOUND AND RX_SAMPLE_24BIT)
add_subdirectory(perseus)
endif()

Wyświetl plik

@ -0,0 +1,59 @@
project(sdrplay)
set(sdrplayv3_SOURCES
sdrplayv3input.cpp
sdrplayv3plugin.cpp
sdrplayv3settings.cpp
sdrplayv3webapiadapter.cpp
sdrplayv3thread.cpp
)
set(sdrplayv3_HEADERS
sdrplayv3input.h
sdrplayv3plugin.h
sdrplayv3settings.h
sdrplayv3webapiadapter.h
sdrplayv3thread.h
)
include_directories(
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
${SDRPLAY_INCLUDE_DIR}
)
if(NOT SERVER_MODE)
set(sdrplayv3_SOURCES
${sdrplayv3_SOURCES}
sdrplayv3gui.cpp
sdrplayv3gui.ui
)
set(sdrplayv3_HEADERS
${sdrplayv3_HEADERS}
sdrplayv3gui.h
)
set(TARGET_NAME inputsdrplayv3)
set(TARGET_LIB "Qt5::Widgets")
set(TARGET_LIB_GUI "sdrgui")
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
else()
set(TARGET_NAME inputsdrplayv3srv)
set(TARGET_LIB "")
set(TARGET_LIB_GUI "")
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()
add_library(${TARGET_NAME} SHARED
${sdrplayv3_SOURCES}
)
target_link_libraries(${TARGET_NAME}
Qt5::Core
${TARGET_LIB}
sdrbase
${TARGET_LIB_GUI}
swagger
${SDRPLAY_LIBRARIES}
)
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})

Wyświetl plik

@ -0,0 +1,118 @@
<h1>SDRplay plugin</h1>
<h2>Introduction</h2>
This plugin supports input from SDRplay RSP devices using V3 of SDRplay's API, including RSP1, RSP1A, RSP2, RSPduo and RSPdx.
<h2>Interface</h2>
![SDRplay v3 plugin GUI](../../../doc/img/SDRPlayV3_plugin.png)
<h3>1: Start/Stop</h3>
Device start / stop button.
- Blue triangle icon: device is ready and can be started
- Green square icon: device is running and can be stopped
- Magenta (or pink) square icon: an error occurred. In the case the device was accidentally disconnected you may click on the icon to stop, plug back in, check the source on the sampling devices control panel and start again.
<h3>2: Sample rate</h3>
This is the sample rate at which IQ samples are transfered from the device to SDRangel, in kS/s (k).
<h3>3: Center frequency</h3>
This is the center frequency of reception in kHz.
<h3>4: Local oscillator frequency correction</h3>
This is the correction in tenths of ppm steps.
<h3>5: Tuner selection</h3>
Selects which tuner is used for input. For RSPduo this can be 1 or 2. Other RSP devices only have a single tuner.
<h3>6: Antenna port</h3>
Selects which antenna port is used. The antenna ports available depend upon the RSP device and tuner selected.
<h3>7: DC offset correction</h3>
Check this button to enable DC offset correction.
<h3>8: IQ imbalance correction</h3>
Check this button to enable IQ imbalance correction.
<h3>9: External reference clock output</h3>
Enable reference clock output. This is only available for RSP2 and DSPduo.
<h3>10: Bias tee</h3>
Enable bias tee. This is only available for RSP1A, RSP2, RSPduo tuner 2 and RSPdx.
<h3>11: AM notch filter</h3>
Enable AM notch filter. This is only available for RSPduo tuner 1.
<h3>12: MW/FM notch filter</h3>
Enable MW/FM notch filter. This is only available for RSP1A, RSP2, RSPduo and RSPdx.
<h3>13: DAB notch filter</h3>
Enable DAB notch filter. This is only available for RSP1A, RSPduo and RSPdx.
<h3>14: IF bandwidth</h3>
This selects the IF filter bandwidth. The following bandwidths are available:
- 200 kHz
- 300 kHz
- 600 kHz
- 1536 kHz
- 5000 kHz
- 6000 kHz
- 7000 kHz
- 8000 kHz
<h3>15: IF frequency</h3>
This selects the IF frequency between these values:
- 0 for zero IF
- 450 kHz: you have to set sample rate to 1792 kHz (16) and use decimation (17) with an infradyne position (18)
- 1620 kHz: you have to set sample rate to 6400 kHz (16) and use decimation (17) with an infradyne position (18)
- 2048 kHz: you have to set sample rate to 8192 kHz (16) and use decimation (17) with an infradyne position (18)
<h3>16: Sample rate</h3>
Sets the ADC IQ sample rats from 2M to 10.66M Hz.
<h3>17: Decimation</h3>
Decimation in powers of two from 1 (no decimation) to 64.
<h3>18: Decimated bandpass center frequency position relative the SDRplay center frequency</h3>
- **Cen**: the decimation operation takes place around the SDRplay center frequency Fs.
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
<h3>19. RF gain setting</h3>
Sets the LNA and mixer gain dB. The settings available depended upon the RSP device and frequency band.
<h3>20. IF AGC</h3>
Check this button to enable IF automatic gain control,
<h3>21. IF gain</h3>
Manual IF gain from 0 to -59 dB. Only enabled when IF AGC is disabled.

Wyświetl plik

@ -0,0 +1,491 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 <QDebug>
#include <QMessageBox>
#include "sdrplayv3gui.h"
#include "sdrplayv3input.h"
#include "device/deviceapi.h"
#include "device/deviceuiset.h"
#include "ui_sdrplayv3gui.h"
#include "gui/colormapper.h"
#include "gui/glspectrum.h"
#include "gui/crightclickenabler.h"
#include "gui/basicdevicesettingsdialog.h"
#include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
SDRPlayV3Gui::SDRPlayV3Gui(DeviceUISet *deviceUISet, QWidget* parent) :
DeviceGUI(parent),
ui(new Ui::SDRPlayV3Gui),
m_deviceUISet(deviceUISet),
m_doApplySettings(true),
m_forceSettings(true)
{
m_sdrPlayV3Input = (SDRPlayV3Input*) m_deviceUISet->m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, 1U, 2000000U);
ui->ifFrequency->clear();
for (unsigned int i = 0; i < SDRPlayV3IF::getNbIFs(); i++)
{
ui->ifFrequency->addItem(QString::number(SDRPlayV3IF::getIF(i)/1000));
}
ui->samplerate->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->samplerate->setValueRange(8, 2000000U, 10660000U);
ui->bandwidth->clear();
for (unsigned int i = 0; i < SDRPlayV3Bandwidths::getNbBandwidths(); i++)
{
ui->bandwidth->addItem(QString::number(SDRPlayV3Bandwidths::getBandwidth(i)/1000));
}
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
ui->tuner->blockSignals(true);
ui->antenna->blockSignals(true);
ui->tuner->clear();
ui->antenna->clear();
switch (m_sdrPlayV3Input->getDeviceId())
{
case SDRPLAY_RSP1_ID:
ui->tuner->addItem("1");
ui->antenna->addItem("50Ohm");
ui->amNotch->setVisible(false);
ui->biasTee->setVisible(false);
ui->extRef->setVisible(false);
break;
case SDRPLAY_RSP1A_ID:
ui->tuner->addItem("1");
ui->antenna->addItem("50Ohm");
ui->amNotch->setVisible(false);
ui->extRef->setVisible(false);
break;
case SDRPLAY_RSP2_ID:
ui->tuner->addItem("1");
ui->antenna->addItem("A");
ui->antenna->addItem("B");
ui->antenna->addItem("Hi-Z");
ui->amNotch->setVisible(false);
break;
case SDRPLAY_RSPduo_ID:
ui->tuner->addItem("1");
ui->tuner->addItem("2");
ui->antenna->addItem("50Ohm");
ui->antenna->addItem("Hi-Z");
ui->biasTee->setVisible(false);
break;
case SDRPLAY_RSPdx_ID:
ui->tuner->addItem("1");
ui->antenna->addItem("A");
ui->antenna->addItem("B");
ui->antenna->addItem("C");
ui->amNotch->setVisible(false);
ui->extRef->setVisible(false);
break;
}
ui->tuner->blockSignals(false);
ui->antenna->blockSignals(false);
displaySettings();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sdrPlayV3Input->setMessageQueueToGUI(&m_inputMessageQueue);
}
SDRPlayV3Gui::~SDRPlayV3Gui()
{
delete ui;
}
void SDRPlayV3Gui::destroy()
{
delete this;
}
void SDRPlayV3Gui::resetToDefaults()
{
m_settings.resetToDefaults();
displaySettings();
sendSettings();
}
QByteArray SDRPlayV3Gui::serialize() const
{
return m_settings.serialize();
}
bool SDRPlayV3Gui::deserialize(const QByteArray& data)
{
if(m_settings.deserialize(data))
{
displaySettings();
m_forceSettings = true;
sendSettings();
return true;
}
else
{
resetToDefaults();
return false;
}
}
bool SDRPlayV3Gui::handleMessage(const Message& message)
{
if (SDRPlayV3Input::MsgConfigureSDRPlayV3::match(message))
{
const SDRPlayV3Input::MsgConfigureSDRPlayV3& cfg = (SDRPlayV3Input::MsgConfigureSDRPlayV3&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else if (SDRPlayV3Input::MsgStartStop::match(message))
{
SDRPlayV3Input::MsgStartStop& notif = (SDRPlayV3Input::MsgStartStop&) message;
blockApplySettings(true);
ui->startStop->setChecked(notif.getStartStop());
blockApplySettings(false);
return true;
}
else
{
return false;
}
}
void SDRPlayV3Gui::handleInputMessages()
{
Message* message;
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("SDRPlayV3Gui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("SDRPlayV3Gui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}
void SDRPlayV3Gui::updateSampleRateAndFrequency()
{
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
}
void SDRPlayV3Gui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->ppm->setValue(m_settings.m_LOppmTenths);
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
ui->tuner->setCurrentIndex(m_settings.m_tuner);
ui->antenna->setCurrentIndex(m_settings.m_antenna);
ui->samplerate->setValue(m_settings.m_devSampleRate);
ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
ui->extRef->setChecked(m_settings.m_extRef);
ui->biasTee->setChecked(m_settings.m_biasTee);
ui->amNotch->setChecked(m_settings.m_amNotch);
ui->fmNotch->setChecked(m_settings.m_fmNotch);
ui->dabNotch->setChecked(m_settings.m_dabNotch);
ui->bandwidth->setCurrentIndex(m_settings.m_bandwidthIndex);
ui->ifFrequency->setCurrentIndex(m_settings.m_ifFrequencyIndex);
ui->samplerate->setValue(m_settings.m_devSampleRate);
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
updateLNAValues();
ui->gainLNA->setCurrentIndex(m_settings.m_lnaIndex);
if (m_settings.m_ifAGC)
{
ui->gainIFAGC->setChecked(true);
ui->gainIF->setEnabled(false);
}
else
{
ui->gainIFAGC->setChecked(false);
ui->gainIF->setEnabled(true);
}
int gain = m_settings.m_ifGain;
ui->gainIF->setValue(gain);
QString gainText = QStringLiteral("%1").arg(gain, 2, 10, QLatin1Char('0'));
ui->gainIFText->setText(gainText);
}
void SDRPlayV3Gui::updateLNAValues()
{
int currentValue = ui->gainLNA->currentText().toInt();
bool found = false;
const int *attenuations = SDRPlayV3LNA::getAttenuations(m_sdrPlayV3Input->getDeviceId(), m_settings.m_centerFrequency);
int len = attenuations[0];
ui->gainLNA->clear();
for (int i = 1; i <= len; i++)
{
if (attenuations[i] == 0)
ui->gainLNA->addItem("0");
else
ui->gainLNA->addItem(QString("-%1").arg(attenuations[i]));
// Find closest match
if ((attenuations[i] == -currentValue) || (!found && (attenuations[i] > -currentValue)))
{
ui->gainLNA->setCurrentIndex(i - 1);
found = true;
}
}
}
void SDRPlayV3Gui::sendSettings()
{
if(!m_updateTimer.isActive())
m_updateTimer.start(100);
}
void SDRPlayV3Gui::updateHardware()
{
qDebug() << "SDRPlayV3Gui::updateHardware";
SDRPlayV3Input::MsgConfigureSDRPlayV3* message = SDRPlayV3Input::MsgConfigureSDRPlayV3::create(m_settings, m_forceSettings);
m_sdrPlayV3Input->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
}
void SDRPlayV3Gui::updateStatus()
{
int state = m_deviceUISet->m_deviceAPI->state();
if(m_lastEngineState != state)
{
switch(state)
{
case DeviceAPI::StNotStarted:
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
break;
case DeviceAPI::StIdle:
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
break;
case DeviceAPI::StRunning:
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
break;
case DeviceAPI::StError:
ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
break;
default:
break;
}
m_lastEngineState = state;
}
}
void SDRPlayV3Gui::on_centerFrequency_changed(quint64 value)
{
m_settings.m_centerFrequency = value * 1000;
updateLNAValues();
sendSettings();
}
void SDRPlayV3Gui::on_ppm_valueChanged(int value)
{
m_settings.m_LOppmTenths = value;
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
sendSettings();
}
void SDRPlayV3Gui::on_tuner_currentIndexChanged(int index)
{
m_settings.m_tuner = index;
if (m_sdrPlayV3Input->getDeviceId() == SDRPLAY_RSPduo_ID)
{
ui->antenna->clear();
ui->antenna->addItem("50Ohm");
if (m_settings.m_tuner == 0)
ui->antenna->addItem("Hi-Z");
ui->amNotch->setVisible(index == 0);
ui->biasTee->setVisible(index == 1);
}
sendSettings();
}
void SDRPlayV3Gui::on_antenna_currentIndexChanged(int index)
{
m_settings.m_antenna = index;
sendSettings();
}
void SDRPlayV3Gui::on_dcOffset_toggled(bool checked)
{
m_settings.m_dcBlock = checked;
sendSettings();
}
void SDRPlayV3Gui::on_iqImbalance_toggled(bool checked)
{
m_settings.m_iqCorrection = checked;
sendSettings();
}
void SDRPlayV3Gui::on_extRef_toggled(bool checked)
{
m_settings.m_extRef = checked;
sendSettings();
}
void SDRPlayV3Gui::on_biasTee_toggled(bool checked)
{
m_settings.m_biasTee = checked;
sendSettings();
}
void SDRPlayV3Gui::on_amNotch_toggled(bool checked)
{
m_settings.m_amNotch = checked;
sendSettings();
}
void SDRPlayV3Gui::on_fmNotch_toggled(bool checked)
{
m_settings.m_fmNotch = checked;
sendSettings();
}
void SDRPlayV3Gui::on_dabNotch_toggled(bool checked)
{
m_settings.m_dabNotch = checked;
sendSettings();
}
void SDRPlayV3Gui::on_bandwidth_currentIndexChanged(int index)
{
m_settings.m_bandwidthIndex = index;
sendSettings();
}
void SDRPlayV3Gui::on_samplerate_changed(quint64 value)
{
m_settings.m_devSampleRate = (uint32_t)value;
sendSettings();
}
void SDRPlayV3Gui::on_ifFrequency_currentIndexChanged(int index)
{
m_settings.m_ifFrequencyIndex = index;
sendSettings();
}
void SDRPlayV3Gui::on_decim_currentIndexChanged(int index)
{
m_settings.m_log2Decim = index;
sendSettings();
}
void SDRPlayV3Gui::on_fcPos_currentIndexChanged(int index)
{
m_settings.m_fcPos = (SDRPlayV3Settings::fcPos_t) index;
sendSettings();
}
void SDRPlayV3Gui::on_gainLNA_currentIndexChanged(int index)
{
m_settings.m_lnaIndex = index;
sendSettings();
}
void SDRPlayV3Gui::on_gainIFAGC_toggled(bool checked)
{
m_settings.m_ifAGC = checked;
ui->gainIF->setEnabled(!checked);
sendSettings();
}
void SDRPlayV3Gui::on_gainIF_valueChanged(int value)
{
m_settings.m_ifGain = value;
QString gainText = QStringLiteral("%1").arg(value, 2, 10, QLatin1Char('0'));
ui->gainIFText->setText(gainText);
sendSettings();
}
void SDRPlayV3Gui::on_startStop_toggled(bool checked)
{
if (m_doApplySettings)
{
SDRPlayV3Input::MsgStartStop *message = SDRPlayV3Input::MsgStartStop::create(checked);
m_sdrPlayV3Input->getInputMessageQueue()->push(message);
}
}
void SDRPlayV3Gui::openDeviceSettingsDialog(const QPoint& p)
{
BasicDeviceSettingsDialog dialog(this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
dialog.move(p);
dialog.exec();
m_settings.m_useReverseAPI = dialog.useReverseAPI();
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
sendSettings();
}

Wyświetl plik

@ -0,0 +1,99 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3GUI_H_
#define PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3GUI_H_
#include <device/devicegui.h>
#include <QTimer>
#include <QWidget>
#include "util/messagequeue.h"
#include "sdrplayv3input.h"
#include "sdrplayv3settings.h"
class DeviceUISet;
namespace Ui {
class SDRPlayV3Gui;
}
class SDRPlayV3Gui : public DeviceGUI {
Q_OBJECT
public:
explicit SDRPlayV3Gui(DeviceUISet *deviceUISet, QWidget* parent = 0);
virtual ~SDRPlayV3Gui();
virtual void destroy();
virtual void resetToDefaults();
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
private:
Ui::SDRPlayV3Gui* ui;
DeviceUISet* m_deviceUISet;
bool m_doApplySettings;
bool m_forceSettings;
SDRPlayV3Settings m_settings;
QTimer m_updateTimer;
QTimer m_statusTimer;
SDRPlayV3Input* m_sdrPlayV3Input;
int m_sampleRate;
quint64 m_deviceCenterFrequency;
int m_lastEngineState;
MessageQueue m_inputMessageQueue;
void blockApplySettings(bool block) { m_doApplySettings = !block; }
void displaySettings();
void updateLNAValues();
void sendSettings();
void updateSampleRateAndFrequency();
bool handleMessage(const Message& message);
private slots:
void updateHardware();
void updateStatus();
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_ppm_valueChanged(int value);
void on_tuner_currentIndexChanged(int index);
void on_antenna_currentIndexChanged(int index);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);
void on_extRef_toggled(bool checked);
void on_biasTee_toggled(bool checked);
void on_amNotch_toggled(bool checked);
void on_fmNotch_toggled(bool checked);
void on_dabNotch_toggled(bool checked);
void on_bandwidth_currentIndexChanged(int index);
void on_samplerate_changed(quint64 value);
void on_ifFrequency_currentIndexChanged(int index);
void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index);
void on_gainLNA_currentIndexChanged(int index);
void on_gainIFAGC_toggled(bool checked);
void on_gainIF_valueChanged(int value);
void on_startStop_toggled(bool checked);
void openDeviceSettingsDialog(const QPoint& p);
};
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3GUI_H_ */

Wyświetl plik

@ -0,0 +1,799 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SDRPlayV3Gui</class>
<widget class="QWidget" name="SDRPlayV3Gui">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>317</width>
<height>260</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>260</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>SDRPlayV3</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_freq">
<property name="topMargin">
<number>4</number>
</property>
<item>
<layout class="QVBoxLayout" name="deviceUILayout">
<item>
<layout class="QHBoxLayout" name="deviceButtonsLayout">
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
<string>start/stop acquisition</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="deviceRateLayout">
<item>
<widget class="QLabel" name="deviceRateText">
<property name="toolTip">
<string>I/Q sample rate kS/s</string>
</property>
<property name="text">
<string>00000k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="freqLeftSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="ValueDial" name="centerFrequency" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>20</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Tuner center frequency in kHz</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="freqUnits">
<property name="text">
<string> kHz</string>
</property>
</widget>
</item>
<item>
<spacer name="freqRightlSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_ppm">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="2">
<widget class="QLabel" name="ppmText">
<property name="minimumSize">
<size>
<width>40</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 row="0" column="0">
<widget class="QLabel" name="ppmLabel">
<property name="text">
<string>LO ppm</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSlider" name="ppm">
<property name="toolTip">
<string>Local Oscillator ppm correction</string>
</property>
<property name="minimum">
<number>-200</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="inputLayout">
<item>
<widget class="QLabel" name="tunerLabel">
<property name="text">
<string>Tuner</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="tuner">
<property name="toolTip">
<string>Tuner</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="antennaLabel">
<property name="text">
<string>Ant</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="antenna">
<property name="toolTip">
<string>Antenna port</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_corr">
<item row="1" column="0">
<widget class="QLabel" name="corrLabel">
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item row="1" column="10">
<widget class="ButtonSwitch" name="dabNotch">
<property name="toolTip">
<string>Enable DAB notch filter</string>
</property>
<property name="text">
<string>DAB</string>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="ButtonSwitch" name="biasTee">
<property name="toolTip">
<string>Enable bias tee</string>
</property>
<property name="text">
<string>T</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="ButtonSwitch" name="iqImbalance">
<property name="toolTip">
<string>Automatic IQ imbalance correction</string>
</property>
<property name="text">
<string>IQ</string>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_2">
<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 row="1" column="1">
<widget class="ButtonSwitch" name="dcOffset">
<property name="toolTip">
<string>Automatic DC offset removal</string>
</property>
<property name="text">
<string>DC</string>
</property>
</widget>
</item>
<item row="1" column="9">
<widget class="ButtonSwitch" name="fmNotch">
<property name="toolTip">
<string>Enable MW/FM notch filter</string>
</property>
<property name="text">
<string>MW/FM</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="ButtonSwitch" name="extRef">
<property name="toolTip">
<string>Enable external reference clock output</string>
</property>
<property name="text">
<string>REF</string>
</property>
</widget>
</item>
<item row="1" column="8">
<widget class="ButtonSwitch" name="amNotch">
<property name="toolTip">
<string>Enable AM notch filter</string>
</property>
<property name="text">
<string>AM</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_freq">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_samplerate">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="4">
<spacer name="horizontalSpacer_3">
<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 row="0" column="2">
<widget class="QComboBox" name="bandwidth">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>IF bandwidth in kHz</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="bandwidthLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>BW </string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="bandwidthUnit">
<property name="text">
<string>kHz</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QComboBox" name="ifFrequency">
<property name="toolTip">
<string>IF frequency in kHz</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="ifFrequencyLabel">
<property name="text">
<string>IF</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="label">
<property name="text">
<string>kHz</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0,0,0,0,0,0,0">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="5">
<widget class="QComboBox" name="decim">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Decimation factor</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>16</string>
</property>
</item>
<item>
<property name="text">
<string>32</string>
</property>
</item>
<item>
<property name="text">
<string>64</string>
</property>
</item>
</widget>
</item>
<item row="0" column="3">
<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 row="0" column="6">
<widget class="QLabel" name="label_fcPos">
<property name="text">
<string>Fp</string>
</property>
</widget>
</item>
<item row="0" column="8">
<spacer name="fcPosRightSpacer">
<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 row="0" column="7">
<widget class="QComboBox" name="fcPos">
<property name="toolTip">
<string>Relative position of device center frequency</string>
</property>
<item>
<property name="text">
<string>Inf</string>
</property>
</item>
<item>
<property name="text">
<string>Sup</string>
</property>
</item>
<item>
<property name="text">
<string>Cen</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SR</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_decim">
<property name="text">
<string>Dec</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="samplerateUnit">
<property name="text">
<string>S/s</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="ValueDial" name="samplerate" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Sample rate</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_lna">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_gain">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="5">
<widget class="ButtonSwitch" name="gainIFAGC">
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Enable IF AGC</string>
</property>
<property name="text">
<string>IF AGC</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QLabel" name="gainIFLabel">
<property name="text">
<string>IF</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QDial" name="gainIF">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>IF gain (dB)</string>
</property>
<property name="minimum">
<number>-59</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="gainLabel">
<property name="text">
<string>Gain</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="gainLNA">
<property name="toolTip">
<string>RF (LNA and mixer) gain in dB</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="gainLNALabel">
<property name="text">
<string>RF</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QLabel" name="gainIFText">
<property name="toolTip">
<string>Baseband amplifier gain in dB</string>
</property>
<property name="text">
<string>00</string>
</property>
</widget>
</item>
<item row="0" column="9">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_vga1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="padLayout">
<item>
<spacer name="verticalPadSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_vga2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>
</resources>
<connections/>
</ui>

Wyświetl plik

@ -0,0 +1,200 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3INPUT_H_
#define PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3INPUT_H_
#include <stdint.h>
#include <QString>
#include <QByteArray>
#include <QNetworkRequest>
#include <sdrplay_api.h>
#include "dsp/devicesamplesource.h"
#include "sdrplayv3settings.h"
class QNetworkAccessManager;
class QNetworkReply;
class DeviceAPI;
class SDRPlayV3Thread;
class SDRPlayV3Input : public DeviceSampleSource {
Q_OBJECT
public:
class MsgConfigureSDRPlayV3 : public Message {
MESSAGE_CLASS_DECLARATION
public:
const SDRPlayV3Settings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
static MsgConfigureSDRPlayV3* create(const SDRPlayV3Settings& settings, bool force)
{
return new MsgConfigureSDRPlayV3(settings, force);
}
private:
SDRPlayV3Settings m_settings;
bool m_force;
MsgConfigureSDRPlayV3(const SDRPlayV3Settings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
{ }
};
class MsgStartStop : public Message {
MESSAGE_CLASS_DECLARATION
public:
bool getStartStop() const { return m_startStop; }
static MsgStartStop* create(bool startStop) {
return new MsgStartStop(startStop);
}
protected:
bool m_startStop;
MsgStartStop(bool startStop) :
Message(),
m_startStop(startStop)
{ }
};
SDRPlayV3Input(DeviceAPI *deviceAPI);
virtual ~SDRPlayV3Input();
virtual void destroy();
virtual void init();
virtual bool start();
virtual void stop();
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
virtual const QString& getDeviceDescription() const;
virtual int getSampleRate() const;
virtual void setSampleRate(int sampleRate) { (void) sampleRate; }
virtual quint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
virtual bool handleMessage(const Message& message);
virtual int webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage);
virtual int webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage);
virtual int webapiReportGet(
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage);
virtual int webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage);
virtual int webapiRun(
bool run,
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage);
static void webapiFormatDeviceSettings(
SWGSDRangel::SWGDeviceSettings& response,
const SDRPlayV3Settings& settings);
static void webapiUpdateDeviceSettings(
SDRPlayV3Settings& settings,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response);
int getDeviceId();
private:
DeviceAPI *m_deviceAPI;
QMutex m_mutex;
SDRPlayV3Settings m_settings;
sdrplay_api_DeviceT m_devs[SDRPLAY_MAX_DEVICES];
sdrplay_api_DeviceT* m_dev;
sdrplay_api_DeviceParamsT *m_devParams;
SDRPlayV3Thread* m_sdrPlayThread;
QString m_deviceDescription;
int m_devNumber;
bool m_running;
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
bool openDevice();
void closeDevice();
bool applySettings(const SDRPlayV3Settings& settings, bool forwardChange, bool force);
bool setDeviceCenterFrequency(quint64 freq);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const SDRPlayV3Settings& settings, bool force);
void webapiReverseSendStartStop(bool start);
private slots:
void networkManagerFinished(QNetworkReply *reply);
};
// ====================================================================
class SDRPlayV3Bandwidths {
public:
static sdrplay_api_Bw_MHzT getBandwidthEnum(unsigned int bandwidth_index);
static unsigned int getBandwidth(unsigned int bandwidth_index);
static unsigned int getBandwidthIndex(unsigned int bandwidth);
static unsigned int getNbBandwidths();
private:
static const unsigned int m_nb_bw = 8;
static unsigned int m_bw[m_nb_bw];
static sdrplay_api_Bw_MHzT m_bwEnums[m_nb_bw];
};
class SDRPlayV3IF {
public:
static sdrplay_api_If_kHzT getIFEnum(unsigned int if_index);
static unsigned int getIF(unsigned int if_index);
static unsigned int getIFIndex(unsigned int iff);
static unsigned int getNbIFs();
private:
static const unsigned int m_nb_if = 4;
static unsigned int m_if[m_nb_if];
static sdrplay_api_If_kHzT m_ifEnums[m_nb_if];
};
class SDRPlayV3LNA {
public:
static const int *getAttenuations(int deviceId, qint64 frequency);
private:
static const int rsp1Attenuation[3][5];
static const int rsp1AAttenuation[4][11];
static const int rsp2Attenuation[3][10];
static const int rspDuoAttenuation[5][11];
static const int rspDxAttenuation[6][28];
};
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3INPUT_H_ */

Wyświetl plik

@ -0,0 +1,185 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 <QtPlugin>
#include <sdrplay_api.h>
#include "plugin/pluginapi.h"
#include "util/simpleserializer.h"
#ifdef SERVER_MODE
#include "sdrplayv3input.h"
#else
#include "sdrplayv3gui.h"
#endif
#include "sdrplayv3plugin.h"
#include "sdrplayv3webapiadapter.h"
const PluginDescriptor SDRPlayV3Plugin::m_pluginDescriptor = {
QStringLiteral("SDRPlayV3"),
QStringLiteral("SDRPlayV3 Input"),
QStringLiteral("6.7.1"),
QStringLiteral("(c) Jon Beniston, M7RCE and Edouard Griffiths, F4EXB"),
QStringLiteral("https://github.com/f4exb/sdrangel"),
true,
QStringLiteral("https://github.com/f4exb/sdrangel")
};
static constexpr const char* const m_hardwareID = "SDRplayV3";
static constexpr const char* const m_deviceTypeID = SDRPLAYV3_DEVICE_TYPE_ID;
SDRPlayV3Plugin::SDRPlayV3Plugin(QObject* parent) :
QObject(parent)
{
sdrplay_api_ErrT err;
float ver = 0.0f;
qDebug() << "SDRPlayV3Plugin: calling sdrplay_api_Open()";
if ((err = sdrplay_api_Open()) != sdrplay_api_Success)
qCritical() << "SDRPlayV3Plugin::SDRPlayV3Plugin: sdrplay_api_Open() was unsuccessful. " << sdrplay_api_GetErrorString(err);
if ((err = sdrplay_api_ApiVersion(&ver)) != sdrplay_api_Success)
qCritical() << "SDRPlayV3Plugin::SDRPlayV3Plugin: failed to get SDRPlay API version.";
if (ver != SDRPLAY_API_VERSION)
qCritical() << "SDRPlayV3Plugin::SDRPlayV3Plugin: SDRPlay API versions do not match " << ver << " " << SDRPLAY_API_VERSION;
}
SDRPlayV3Plugin::~SDRPlayV3Plugin()
{
sdrplay_api_Close();
}
const PluginDescriptor& SDRPlayV3Plugin::getPluginDescriptor() const
{
return m_pluginDescriptor;
}
void SDRPlayV3Plugin::initPlugin(PluginAPI* pluginAPI)
{
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
void SDRPlayV3Plugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
sdrplay_api_LockDeviceApi();
sdrplay_api_ErrT err;
sdrplay_api_DeviceT devs[6];
unsigned int count;
if ((err = sdrplay_api_GetDevices(devs, &count, sizeof(devs) / sizeof(sdrplay_api_DeviceT))) == sdrplay_api_Success)
{
for(unsigned int i = 0; i < count; i++)
{
qDebug("SDRPlayV3Plugin::enumSampleSources: found %d - %s", devs[i].hwVer, devs[i].SerNo);
QString displayableName(QString("SDRPlayV3[%1] %2").arg(i).arg(devs[i].SerNo));
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
devs[i].SerNo,
i, // sequence
1, // Nb Rx
0 // Nb Tx
));
}
listedHwIds.append(m_hardwareID);
}
else
qCritical() << "SDRPlayV3Plugin::enumOriginDevices: Failed to get SDRPlay devices: " << sdrplay_api_GetErrorString(err);
sdrplay_api_UnlockDeviceApi();
}
PluginInterface::SamplingDevices SDRPlayV3Plugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
it->hardwareId,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
qDebug("SDRPlayV3Plugin::enumSampleSources: enumerated SDRPlayV3 RSP1 device #%d", it->sequence);
}
}
return result;
}
#ifdef SERVER_MODE
DeviceGUI* SDRPlayV3Plugin::createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,
DeviceUISet *deviceUISet)
{
(void) sourceId;
(void) widget;
(void) deviceUISet;
return 0;
}
#else
DeviceGUI* SDRPlayV3Plugin::createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,
DeviceUISet *deviceUISet)
{
if(sourceId == m_deviceTypeID)
{
SDRPlayV3Gui* gui = new SDRPlayV3Gui(deviceUISet);
*widget = gui;
return gui;
}
else
{
return 0;
}
}
#endif
DeviceSampleSource *SDRPlayV3Plugin::createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI)
{
if (sourceId == m_deviceTypeID)
{
SDRPlayV3Input* input = new SDRPlayV3Input(deviceAPI);
return input;
}
else
{
return 0;
}
}
DeviceWebAPIAdapter *SDRPlayV3Plugin::createDeviceWebAPIAdapter() const
{
return new SDRPlayV3WebAPIAdapter();
}

Wyświetl plik

@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3PLUGIN_H_
#define PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3PLUGIN_H_
#include <QObject>
#include "plugin/plugininterface.h"
class PluginAPI;
#define SDRPLAYV3_DEVICE_TYPE_ID "sdrangel.samplesource.sdrplayv3"
class SDRPlayV3Plugin : public QObject, public PluginInterface {
Q_OBJECT
Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID SDRPLAYV3_DEVICE_TYPE_ID)
public:
explicit SDRPlayV3Plugin(QObject* parent = NULL);
~SDRPlayV3Plugin();
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual DeviceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,
DeviceUISet *deviceUISet);
virtual DeviceSampleSource* createSampleSourcePluginInstance(const QString& sourceId, DeviceAPI *deviceAPI);
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const;
private:
static const PluginDescriptor m_pluginDescriptor;
};
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3PLUGIN_H_ */

Wyświetl plik

@ -0,0 +1,139 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 "sdrplayv3settings.h"
#include <QtGlobal>
#include "util/simpleserializer.h"
SDRPlayV3Settings::SDRPlayV3Settings()
{
resetToDefaults();
}
void SDRPlayV3Settings::resetToDefaults()
{
m_centerFrequency = 7040*1000;
m_LOppmTenths = 0;
m_ifFrequencyIndex = 0;
m_bandwidthIndex = 0;
m_devSampleRate = 2000000;
m_log2Decim = 0;
m_fcPos = FC_POS_CENTER;
m_dcBlock = false;
m_iqCorrection = false;
m_lnaIndex = 0;
m_ifAGC = true;
m_ifGain = 29;
m_amNotch = false;
m_fmNotch = false;
m_dabNotch = false;
m_biasTee = false;
m_tuner = 0;
m_antenna = 0;
m_extRef = false;
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
m_reverseAPIDeviceIndex = 0;
}
QByteArray SDRPlayV3Settings::serialize() const
{
SimpleSerializer s(1);
s.writeS32(1, m_LOppmTenths);
s.writeU32(3, m_ifFrequencyIndex);
s.writeU32(5, m_bandwidthIndex);
s.writeU32(6, m_devSampleRate);
s.writeU32(7, m_log2Decim);
s.writeS32(8, (int) m_fcPos);
s.writeBool(9, m_dcBlock);
s.writeBool(10, m_iqCorrection);
s.writeS32(11, m_lnaIndex);
s.writeBool(13, m_ifAGC);
s.writeS32(14, m_ifGain);
s.writeBool(15, m_useReverseAPI);
s.writeString(16, m_reverseAPIAddress);
s.writeU32(17, m_reverseAPIPort);
s.writeU32(18, m_reverseAPIDeviceIndex);
s.writeBool(19, m_amNotch);
s.writeBool(20, m_fmNotch);
s.writeBool(21, m_dabNotch);
s.writeBool(22, m_biasTee);
s.writeS32(23, m_tuner);
s.writeS32(24, m_antenna);
s.writeBool(25, m_extRef);
return s.final();
}
bool SDRPlayV3Settings::deserialize(const QByteArray& data)
{
SimpleDeserializer d(data);
if (!d.isValid())
{
resetToDefaults();
return false;
}
if (d.getVersion() == 1)
{
int intval;
uint32_t uintval;
d.readS32(1, &m_LOppmTenths, 0);
d.readU32(3, &m_ifFrequencyIndex, 0);
d.readU32(5, &m_bandwidthIndex, 0);
d.readU32(6, &m_devSampleRate, 2000000);
d.readU32(7, &m_log2Decim, 0);
d.readS32(8, &intval, 0);
m_fcPos = (fcPos_t) intval;
d.readBool(9, &m_dcBlock, false);
d.readBool(10, &m_iqCorrection, false);
d.readS32(11, &m_lnaIndex, 0);
d.readBool(13, &m_ifAGC, true);
d.readS32(14, &m_ifGain, 29);
d.readBool(15, &m_useReverseAPI, false);
d.readString(16, &m_reverseAPIAddress, "127.0.0.1");
d.readU32(17, &uintval, 0);
if ((uintval > 1023) && (uintval < 65535)) {
m_reverseAPIPort = uintval;
} else {
m_reverseAPIPort = 8888;
}
d.readU32(18, &uintval, 0);
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
d.readBool(19, &m_amNotch, false);
d.readBool(20, &m_fmNotch, false);
d.readBool(21, &m_dabNotch, false);
d.readBool(22, &m_biasTee, false);
d.readS32(23, &m_tuner, 0);
d.readS32(24, &m_antenna, 0);
d.readBool(25, &m_extRef, false);
return true;
}
else
{
resetToDefaults();
return false;
}
}

Wyświetl plik

@ -0,0 +1,88 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 _SDRPLAYV3_SDRPLAYV3SETTINGS_H_
#define _SDRPLAYV3_SDRPLAYV3SETTINGS_H_
#include <stdint.h>
#include <QByteArray>
#include <QString>
#include <QDebug>
struct SDRPlayV3Settings {
typedef enum {
FC_POS_INFRA = 0,
FC_POS_SUPRA,
FC_POS_CENTER
} fcPos_t;
uint64_t m_centerFrequency;
int32_t m_LOppmTenths;
uint32_t m_ifFrequencyIndex;
uint32_t m_bandwidthIndex;
uint32_t m_devSampleRate;
uint32_t m_log2Decim;
fcPos_t m_fcPos;
bool m_dcBlock;
bool m_iqCorrection;
int m_lnaIndex;
bool m_ifAGC;
int m_ifGain;
bool m_amNotch;
bool m_fmNotch;
bool m_dabNotch;
bool m_biasTee;
int m_tuner;
int m_antenna;
bool m_extRef;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
SDRPlayV3Settings();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
void debug(const char *title) const
{
qDebug() << QString(title)
<< ": m_centerFrequency: " << m_centerFrequency
<< " m_LOppmTenths: " << m_LOppmTenths
<< " m_ifFrequencyIndex: " << m_ifFrequencyIndex
<< " m_bandwidthIndex: " << m_bandwidthIndex
<< " m_devSampleRate: " << m_devSampleRate
<< " m_log2Decim: " << m_log2Decim
<< " m_fcPos: " << m_fcPos
<< " m_dcBlock: " << m_dcBlock
<< " m_iqCorrection: " << m_iqCorrection
<< " m_lnaIndex: " << m_lnaIndex
<< " m_ifAGC: " << m_ifAGC
<< " m_ifGain: " << m_ifGain
<< " m_amNotch: " << m_amNotch
<< " m_fmNotch: " << m_fmNotch
<< " m_dabNotch: " << m_dabNotch
<< " m_biasTee: " << m_biasTee
<< " m_tuner: " << m_tuner
<< " m_antenna: " << m_antenna
<< " m_extRef: " << m_extRef;
}
};
#endif /* _SDRPLAYV3_SDRPLAYV3SETTINGS_H_ */

Wyświetl plik

@ -0,0 +1,220 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 <stdio.h>
#include <errno.h>
#include "sdrplayv3thread.h"
#include "dsp/samplesinkfifo.h"
#include <QDebug>
SDRPlayV3Thread::SDRPlayV3Thread(sdrplay_api_DeviceT* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_dev(dev),
m_convertBuffer(SDRPLAYV3_INIT_NBSAMPLES),
m_sampleFifo(sampleFifo),
m_samplerate(2000000),
m_log2Decim(0),
m_fcPos(0)
{
}
SDRPlayV3Thread::~SDRPlayV3Thread()
{
stopWork();
}
void SDRPlayV3Thread::startWork()
{
m_startWaitMutex.lock();
start();
while(!m_running)
m_startWaiter.wait(&m_startWaitMutex, 100);
m_startWaitMutex.unlock();
}
void SDRPlayV3Thread::stopWork()
{
sdrplay_api_ErrT err;
if (m_running)
{
m_running = false;
if ((err = sdrplay_api_Uninit(m_dev->dev)) != sdrplay_api_Success)
qWarning() << "SDRPlayV3Thread::callbackHelper: sdrplay_api_Uninit error: " << sdrplay_api_GetErrorString(err);
}
wait();
}
void SDRPlayV3Thread::setSamplerate(int samplerate)
{
m_samplerate = samplerate;
}
void SDRPlayV3Thread::setLog2Decimation(unsigned int log2_decim)
{
m_log2Decim = log2_decim;
}
void SDRPlayV3Thread::setFcPos(int fcPos)
{
m_fcPos = fcPos;
}
// Don't really need a thread here - just using same structure as other plugins
void SDRPlayV3Thread::run()
{
sdrplay_api_ErrT err;
sdrplay_api_CallbackFnsT cbFns;
cbFns.StreamACbFn = &SDRPlayV3Thread::callbackHelper;
cbFns.StreamBCbFn = &SDRPlayV3Thread::callbackHelper;
cbFns.EventCbFn = &SDRPlayV3Thread::eventCallback;
if ((err = sdrplay_api_Init(m_dev->dev, &cbFns, this)) != sdrplay_api_Success)
qCritical() << "SDRPlayV3Thread::run: sdrplay_api_Init error: " << sdrplay_api_GetErrorString(err);
m_running = true;
m_startWaiter.wakeAll();
}
void SDRPlayV3Thread::eventCallback(sdrplay_api_EventT eventId, sdrplay_api_TunerSelectT tuner, sdrplay_api_EventParamsT *params, void *cbContext)
{
// Could possibly report params->gainParams.currGain for eventId == sdrplay_api_GainChange
// or indicate ADC overload for eventId == sdrplay_api_PowerOverloadChange
(void) eventId;
(void) tuner;
(void) params;
(void) cbContext;
}
void SDRPlayV3Thread::callbackHelper(short *xi, short *xq, sdrplay_api_StreamCbParamsT *params, unsigned int numSamples, unsigned int reset, void *ctx)
{
(void) params;
(void) reset;
SDRPlayV3Thread* thread = (SDRPlayV3Thread*) ctx;
qint16 iq[8192];
if (thread->m_running)
{
if (numSamples > 8192)
qCritical() << "SDRPlayV3Thread::callbackHelper: IQ buffer too small: " << numSamples;
for (int i = 0; i < numSamples; i++)
{
iq[i*2] = xi[i];
iq[i*2+1] = xq[i];
}
thread->callbackIQ(iq, numSamples*2);
}
}
void SDRPlayV3Thread::callbackIQ(const qint16* buf, qint32 len)
{
SampleVector::iterator it = m_convertBuffer.begin();
if (m_log2Decim == 0)
{
m_decimatorsIQ.decimate1(&it, buf, len);
}
else
{
if (m_fcPos == 0) // Infradyne
{
switch (m_log2Decim)
{
case 1:
m_decimatorsIQ.decimate2_inf(&it, buf, len);
break;
case 2:
m_decimatorsIQ.decimate4_inf(&it, buf, len);
break;
case 3:
m_decimatorsIQ.decimate8_inf(&it, buf, len);
break;
case 4:
m_decimatorsIQ.decimate16_inf(&it, buf, len);
break;
case 5:
m_decimatorsIQ.decimate32_inf(&it, buf, len);
break;
case 6:
m_decimatorsIQ.decimate64_inf(&it, buf, len);
break;
default:
break;
}
}
else if (m_fcPos == 1) // Supradyne
{
switch (m_log2Decim)
{
case 1:
m_decimatorsIQ.decimate2_sup(&it, buf, len);
break;
case 2:
m_decimatorsIQ.decimate4_sup(&it, buf, len);
break;
case 3:
m_decimatorsIQ.decimate8_sup(&it, buf, len);
break;
case 4:
m_decimatorsIQ.decimate16_sup(&it, buf, len);
break;
case 5:
m_decimatorsIQ.decimate32_sup(&it, buf, len);
break;
case 6:
m_decimatorsIQ.decimate64_sup(&it, buf, len);
break;
default:
break;
}
}
else // Centered
{
switch (m_log2Decim)
{
case 1:
m_decimatorsIQ.decimate2_cen(&it, buf, len);
break;
case 2:
m_decimatorsIQ.decimate4_cen(&it, buf, len);
break;
case 3:
m_decimatorsIQ.decimate8_cen(&it, buf, len);
break;
case 4:
m_decimatorsIQ.decimate16_cen(&it, buf, len);
break;
case 5:
m_decimatorsIQ.decimate32_cen(&it, buf, len);
break;
case 6:
m_decimatorsIQ.decimate64_cen(&it, buf, len);
break;
default:
break;
}
}
}
m_sampleFifo->write(m_convertBuffer.begin(), it);
}

Wyświetl plik

@ -0,0 +1,66 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3THREAD_H_
#define PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3THREAD_H_
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <sdrplay_api.h>
#include "dsp/samplesinkfifo.h"
#include "dsp/decimators.h"
#define SDRPLAYV3_INIT_NBSAMPLES (1<<14)
class SDRPlayV3Thread : public QThread {
Q_OBJECT
public:
SDRPlayV3Thread(sdrplay_api_DeviceT* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
~SDRPlayV3Thread();
void startWork();
void stopWork();
void setSamplerate(int samplerate);
void setLog2Decimation(unsigned int log2_decim);
void setFcPos(int fcPos);
private:
QMutex m_startWaitMutex;
QWaitCondition m_startWaiter;
bool m_running;
sdrplay_api_DeviceT *m_dev;
SampleVector m_convertBuffer;
SampleSinkFifo* m_sampleFifo;
int m_samplerate;
unsigned int m_log2Decim;
int m_fcPos;
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, true> m_decimatorsIQ;
void run();
void callbackIQ(const qint16* buf, qint32 len);
static void callbackHelper(short *xi, short *xq, sdrplay_api_StreamCbParamsT *params, unsigned int numSamples, unsigned int reset, void *ctx);
static void eventCallback(sdrplay_api_EventT eventId, sdrplay_api_TunerSelectT tuner, sdrplay_api_EventParamsT *params, void *cbContext);
};
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAYV3_SDRPLAYV3THREAD_H_ */

Wyświetl plik

@ -0,0 +1,53 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// Implementation of static web API adapters used for preset serialization and //
// deserialization //
// //
// 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 "SWGDeviceSettings.h"
#include "sdrplayv3input.h"
#include "sdrplayv3webapiadapter.h"
SDRPlayV3WebAPIAdapter::SDRPlayV3WebAPIAdapter()
{}
SDRPlayV3WebAPIAdapter::~SDRPlayV3WebAPIAdapter()
{}
int SDRPlayV3WebAPIAdapter::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage)
{
(void) errorMessage;
response.setSdrPlayV3Settings(new SWGSDRangel::SWGSDRPlayV3Settings());
response.getSdrPlayV3Settings()->init();
SDRPlayV3Input::webapiFormatDeviceSettings(response, m_settings);
return 200;
}
int SDRPlayV3WebAPIAdapter::webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage)
{
(void) force; // no action
(void) errorMessage;
SDRPlayV3Input::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response);
return 200;
}

Wyświetl plik

@ -0,0 +1,45 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// Implementation of static web API adapters used for preset serialization and //
// deserialization //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "device/devicewebapiadapter.h"
#include "sdrplayv3settings.h"
class SDRPlayV3WebAPIAdapter : public DeviceWebAPIAdapter
{
public:
SDRPlayV3WebAPIAdapter();
virtual ~SDRPlayV3WebAPIAdapter();
virtual QByteArray serialize() { return m_settings.serialize(); }
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
virtual int webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage);
virtual int webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage);
private:
SDRPlayV3Settings m_settings;
};

Wyświetl plik

@ -4243,6 +4243,11 @@ bool WebAPIRequestMapper::getDeviceSettings(
deviceSettings->setSdrPlaySettings(new SWGSDRangel::SWGSDRPlaySettings());
deviceSettings->getSdrPlaySettings()->fromJsonObject(settingsJsonObject);
}
else if (deviceSettingsKey == "sdrPlayV3Settings")
{
deviceSettings->setSdrPlayV3Settings(new SWGSDRangel::SWGSDRPlayV3Settings());
deviceSettings->getSdrPlayV3Settings()->fromJsonObject(settingsJsonObject);
}
else if (deviceSettingsKey == "sigMFFileInputSettings")
{
deviceSettings->setSigMfFileInputSettings(new SWGSDRangel::SWGSigMFFileInputSettings());
@ -4546,6 +4551,7 @@ void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& de
deviceSettings.setRemoteOutputSettings(nullptr);
deviceSettings.setRemoteInputSettings(nullptr);
deviceSettings.setSdrPlaySettings(nullptr);
deviceSettings.setSdrPlayV3Settings(nullptr);
deviceSettings.setTestSourceSettings(nullptr);
deviceSettings.setUsrpInputSettings(nullptr);
deviceSettings.setUsrpOutputSettings(nullptr);
@ -4567,6 +4573,7 @@ void WebAPIRequestMapper::resetDeviceReport(SWGSDRangel::SWGDeviceReport& device
deviceReport.setRemoteOutputReport(nullptr);
deviceReport.setRemoteInputReport(nullptr);
deviceReport.setSdrPlayReport(nullptr);
deviceReport.setSdrPlayV3Report(nullptr);
deviceReport.setUsrpOutputReport(nullptr);
}

Wyświetl plik

@ -105,6 +105,7 @@ const QMap<QString, QString> WebAPIUtils::m_deviceIdToSettingsKey = {
{"sdrangel.samplesource.remoteinput", "remoteInputSettings"},
{"sdrangel.samplesink.remoteoutput", "remoteOutputSettings"},
{"sdrangel.samplesource.sdrplay", "sdrPlaySettings"},
{"sdrangel.samplesource.sdrplayv3", "sdrPlayV3Settings"},
{"sdrangel.samplesource.sigmffileinput", "sigMFFileInputSettings"},
{"sdrangel.samplesource.soapysdrinput", "soapySDRInputSettings"},
{"sdrangel.samplesink.soapysdroutput", "soapySDROutputSettings"},
@ -185,6 +186,7 @@ const QMap<QString, QString> WebAPIUtils::m_sourceDeviceHwIdToSettingsKey = {
{"RTLSDR", "rtlSdrSettings"},
{"RemoteInput", "remoteInputSettings"},
{"SDRplay1", "sdrPlaySettings"},
{"SDRplay", "sdrPlayV3Settings"},
{"SigMFFileInput", "sigMFFileInputSettings"},
{"SoapySDR", "soapySDRInputSettings"},
{"TestSource", "testSourceSettings"},
@ -208,6 +210,7 @@ const QMap<QString, QString> WebAPIUtils::m_sourceDeviceHwIdToActionsKey = {
{"RemoteInput", "remoteInputActions"},
{"RTLSDR", "rtlSdrActions"},
{"SDRplay1", "sdrPlayActions"},
{"SDRplay", "sdrPlayV3Actions"},
{"SigMFFileInput", "sigMFFileActions"},
{"SoapySDR", "soapySDRInputActions"},
{"TestSource", "testSourceActions"},

Wyświetl plik

@ -49,6 +49,8 @@ DeviceReport:
$ref: "http://swgserver:8081/api/swagger/include/RemoteInput.yaml#/RemoteInputReport"
sdrPlayReport:
$ref: "http://swgserver:8081/api/swagger/include/SDRPlay.yaml#/SDRPlayReport"
sdrPlayV3Report:
$ref: "http://swgserver:8081/api/swagger/include/SDRPlayV3.yaml#/SDRPlayV3Report"
sigMFFileInputReport:
$ref: "http://swgserver:8081/api/swagger/include/SigMFFileInput.yaml#/SigMFFileInputReport"
soapySDRInputReport:

Wyświetl plik

@ -70,6 +70,8 @@ DeviceSettings:
$ref: "http://swgserver:8081/api/swagger/include/RemoteInput.yaml#/RemoteInputSettings"
sdrPlaySettings:
$ref: "http://swgserver:8081/api/swagger/include/SDRPlay.yaml#/SDRPlaySettings"
sdrPlayV3Settings:
$ref: "http://swgserver:8081/api/swagger/include/SDRPlayV3.yaml#/SDRPlayV3Settings"
sigMFFileInputSettings:
$ref: "http://swgserver:8081/api/swagger/include/SigMFFileInput.yaml#/SigMFFileInputSettings"
soapySDRInputSettings:

Wyświetl plik

@ -0,0 +1,61 @@
SDRPlayV3Settings:
description: SDRplayV3
properties:
centerFrequency:
type: integer
format: int64
LOppmTenths:
type: integer
ifFrequencyIndex:
type: integer
bandwidthIndex:
type: integer
devSampleRate:
type: integer
log2Decim:
type: integer
fcPos:
type: integer
dcBlock:
type: integer
iqCorrection:
type: integer
lnaIndex:
type: integer
ifAGC:
type: integer
ifGain:
type: integer
amNotch:
type: integer
fmNotch:
type: integer
dabNotch:
type: integer
extRef:
type: integer
tuner:
type: integer
antenna:
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer
SDRPlayV3Report:
description: SDRplayV3
properties:
bandwidths:
type: array
items:
$ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Bandwidth"
intermediateFrequencies:
type: array
items:
$ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Frequency"

Wyświetl plik

@ -3358,19 +3358,35 @@ margin-bottom: 20px;
},
"standard" : {
"type" : "integer",
"description" : "see DATVDemodSettings::dvb_version"
"description" : "DVB bersion (see DATVDemodSettings::dvb_version)\n * 0 - DVB-S\n * 1 - DVB-S2\n"
},
"modulation" : {
"type" : "integer",
"description" : "see DATVDemodSettings::DATVModulation"
"description" : "Modulation type (DATVDemodSettings::DATVModulation)\n * 0 - BPSK\n * 1 - QPSK\n * 2 - PSK8\n * 3 - APSK16\n * 4 - APSK32\n * 5 - APSK64E\n * 6 - QAM16\n * 7 - QAM64\n * 8 - QAM256\n"
},
"fec" : {
"type" : "integer",
"description" : "see DATVDemodSettings::DATVCodeRate"
"description" : "FEC rate (see DATVDemodSettings::DATVCodeRate)\n * 0 - 1/2\n * 1 - 2/3\n * 2 - 4/6\n * 3 - 3/4\n * 4 - 4/6\n * 5 - 7/8\n * 6 - 4/5\n * 7 - 8/9\n * 8 - 9/10\n * 9 - 1/4\n * 10 - 1/3\n * 11 - 2/5\n * 12 - 3/5\n"
},
"softLDPC" : {
"type" : "integer",
"description" : "(boolean) engage sodt LDPC with LDPC tool sub processes (Linux only)"
},
"softLDPCToolPath" : {
"type" : "string",
"description" : "O/S path to the LDPC tool binary"
},
"softLDPCMaxTrials" : {
"type" : "integer",
"description" : "maximum number of trials in the soft LDPC algorithm (LDPC tool parameter)"
},
"maxBitflips" : {
"type" : "integer",
"description" : "maximum number of bit flips allowed in hard LDPC algorithm"
},
"audioMute" : {
"type" : "integer",
"description" : "boolean"
"description" : "(boolean) mute audio output"
},
"audioDeviceName" : {
"type" : "string"
@ -3383,30 +3399,32 @@ margin-bottom: 20px;
},
"allowDrift" : {
"type" : "integer",
"description" : "boolean"
"description" : "(boolean) allow a larger frequency drift (DVB-S)"
},
"fastLock" : {
"type" : "integer",
"description" : "boolean"
"description" : "(boolean) faster locking algorithm (DVB-S)"
},
"filter" : {
"type" : "integer",
"description" : "see DATVDemodSettings::dvb_sampler"
"description" : "Type of sumbol filtering (see DATVDemodSettings::dvb_sampler)\n * 0 - Nearest\n * 1 - Linear\n * 2 - Root Raised Cosine\n"
},
"hardMetric" : {
"type" : "integer",
"description" : "boolean"
"description" : "(boolean) (DVB-S)"
},
"rollOff" : {
"type" : "number",
"format" : "float"
"format" : "float",
"description" : "RRC filter roll-off factor (0..1)"
},
"viterbi" : {
"type" : "integer",
"description" : "boolean"
"description" : "(boolean) (DVB-S)"
},
"excursion" : {
"type" : "integer"
"type" : "integer",
"description" : "RRC filter envelope excursion (dB)"
},
"audioVolume" : {
"type" : "integer"
@ -3424,6 +3442,26 @@ margin-bottom: 20px;
"udpTS" : {
"type" : "integer",
"description" : "boolean"
},
"streamIndex" : {
"type" : "integer",
"description" : "MIMO channel. Not relevant when connected to SI (single Rx)."
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
},
"reverseAPIChannelIndex" : {
"type" : "integer"
}
},
"description" : "DATVDemod"
@ -3892,6 +3930,9 @@ margin-bottom: 20px;
"sdrPlayReport" : {
"$ref" : "#/definitions/SDRPlayReport"
},
"sdrPlayV3Report" : {
"$ref" : "#/definitions/SDRPlayV3Report"
},
"sigMFFileInputReport" : {
"$ref" : "#/definitions/SigMFFileInputReport"
},
@ -4059,6 +4100,9 @@ margin-bottom: 20px;
"sdrPlaySettings" : {
"$ref" : "#/definitions/SDRPlaySettings"
},
"sdrPlayV3Settings" : {
"$ref" : "#/definitions/SDRPlayV3Settings"
},
"sigMFFileInputSettings" : {
"$ref" : "#/definitions/SigMFFileInputSettings"
},
@ -8542,6 +8586,96 @@ margin-bottom: 20px;
}
},
"description" : "SDRplay1"
};
defs.SDRPlayV3Report = {
"properties" : {
"bandwidths" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Bandwidth"
}
},
"intermediateFrequencies" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Frequency"
}
}
},
"description" : "SDRplayV3"
};
defs.SDRPlayV3Settings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"LOppmTenths" : {
"type" : "integer"
},
"ifFrequencyIndex" : {
"type" : "integer"
},
"bandwidthIndex" : {
"type" : "integer"
},
"devSampleRate" : {
"type" : "integer"
},
"log2Decim" : {
"type" : "integer"
},
"fcPos" : {
"type" : "integer"
},
"dcBlock" : {
"type" : "integer"
},
"iqCorrection" : {
"type" : "integer"
},
"lnaIndex" : {
"type" : "integer"
},
"ifAGC" : {
"type" : "integer"
},
"ifGain" : {
"type" : "integer"
},
"amNotch" : {
"type" : "integer"
},
"fmNotch" : {
"type" : "integer"
},
"dabNotch" : {
"type" : "integer"
},
"extRef" : {
"type" : "integer"
},
"tuner" : {
"type" : "integer"
},
"antenna" : {
"type" : "integer"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
}
},
"description" : "SDRplayV3"
};
defs.SSBDemodReport = {
"properties" : {
@ -45892,7 +46026,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-04-02T23:43:06.310+02:00
Generated 2021-04-11T22:11:18.598+02:00
</div>
</div>
</div>

Wyświetl plik

@ -70,6 +70,8 @@ SWGDeviceReport::SWGDeviceReport() {
m_remote_input_report_isSet = false;
sdr_play_report = nullptr;
m_sdr_play_report_isSet = false;
sdr_play_v3_report = nullptr;
m_sdr_play_v3_report_isSet = false;
sig_mf_file_input_report = nullptr;
m_sig_mf_file_input_report_isSet = false;
soapy_sdr_input_report = nullptr;
@ -136,6 +138,8 @@ SWGDeviceReport::init() {
m_remote_input_report_isSet = false;
sdr_play_report = new SWGSDRPlayReport();
m_sdr_play_report_isSet = false;
sdr_play_v3_report = new SWGSDRPlayV3Report();
m_sdr_play_v3_report_isSet = false;
sig_mf_file_input_report = new SWGSigMFFileInputReport();
m_sig_mf_file_input_report_isSet = false;
soapy_sdr_input_report = new SWGSoapySDRReport();
@ -217,6 +221,9 @@ SWGDeviceReport::cleanup() {
if(sdr_play_report != nullptr) {
delete sdr_play_report;
}
if(sdr_play_v3_report != nullptr) {
delete sdr_play_v3_report;
}
if(sig_mf_file_input_report != nullptr) {
delete sig_mf_file_input_report;
}
@ -296,6 +303,8 @@ SWGDeviceReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sdr_play_report, pJson["sdrPlayReport"], "SWGSDRPlayReport", "SWGSDRPlayReport");
::SWGSDRangel::setValue(&sdr_play_v3_report, pJson["sdrPlayV3Report"], "SWGSDRPlayV3Report", "SWGSDRPlayV3Report");
::SWGSDRangel::setValue(&sig_mf_file_input_report, pJson["sigMFFileInputReport"], "SWGSigMFFileInputReport", "SWGSigMFFileInputReport");
::SWGSDRangel::setValue(&soapy_sdr_input_report, pJson["soapySDRInputReport"], "SWGSoapySDRReport", "SWGSoapySDRReport");
@ -391,6 +400,9 @@ SWGDeviceReport::asJsonObject() {
if((sdr_play_report != nullptr) && (sdr_play_report->isSet())){
toJsonValue(QString("sdrPlayReport"), sdr_play_report, obj, QString("SWGSDRPlayReport"));
}
if((sdr_play_v3_report != nullptr) && (sdr_play_v3_report->isSet())){
toJsonValue(QString("sdrPlayV3Report"), sdr_play_v3_report, obj, QString("SWGSDRPlayV3Report"));
}
if((sig_mf_file_input_report != nullptr) && (sig_mf_file_input_report->isSet())){
toJsonValue(QString("sigMFFileInputReport"), sig_mf_file_input_report, obj, QString("SWGSigMFFileInputReport"));
}
@ -629,6 +641,16 @@ SWGDeviceReport::setSdrPlayReport(SWGSDRPlayReport* sdr_play_report) {
this->m_sdr_play_report_isSet = true;
}
SWGSDRPlayV3Report*
SWGDeviceReport::getSdrPlayV3Report() {
return sdr_play_v3_report;
}
void
SWGDeviceReport::setSdrPlayV3Report(SWGSDRPlayV3Report* sdr_play_v3_report) {
this->sdr_play_v3_report = sdr_play_v3_report;
this->m_sdr_play_v3_report_isSet = true;
}
SWGSigMFFileInputReport*
SWGDeviceReport::getSigMfFileInputReport() {
return sig_mf_file_input_report;
@ -777,6 +799,9 @@ SWGDeviceReport::isSet(){
if(sdr_play_report && sdr_play_report->isSet()){
isObjectUpdated = true; break;
}
if(sdr_play_v3_report && sdr_play_v3_report->isSet()){
isObjectUpdated = true; break;
}
if(sig_mf_file_input_report && sig_mf_file_input_report->isSet()){
isObjectUpdated = true; break;
}

Wyświetl plik

@ -41,6 +41,7 @@
#include "SWGRemoteOutputReport.h"
#include "SWGRtlSdrReport.h"
#include "SWGSDRPlayReport.h"
#include "SWGSDRPlayV3Report.h"
#include "SWGSigMFFileInputReport.h"
#include "SWGSoapySDRReport.h"
#include "SWGUSRPInputReport.h"
@ -131,6 +132,9 @@ public:
SWGSDRPlayReport* getSdrPlayReport();
void setSdrPlayReport(SWGSDRPlayReport* sdr_play_report);
SWGSDRPlayV3Report* getSdrPlayV3Report();
void setSdrPlayV3Report(SWGSDRPlayV3Report* sdr_play_v3_report);
SWGSigMFFileInputReport* getSigMfFileInputReport();
void setSigMfFileInputReport(SWGSigMFFileInputReport* sig_mf_file_input_report);
@ -222,6 +226,9 @@ private:
SWGSDRPlayReport* sdr_play_report;
bool m_sdr_play_report_isSet;
SWGSDRPlayV3Report* sdr_play_v3_report;
bool m_sdr_play_v3_report_isSet;
SWGSigMFFileInputReport* sig_mf_file_input_report;
bool m_sig_mf_file_input_report_isSet;

Wyświetl plik

@ -90,6 +90,8 @@ SWGDeviceSettings::SWGDeviceSettings() {
m_remote_input_settings_isSet = false;
sdr_play_settings = nullptr;
m_sdr_play_settings_isSet = false;
sdr_play_v3_settings = nullptr;
m_sdr_play_v3_settings_isSet = false;
sig_mf_file_input_settings = nullptr;
m_sig_mf_file_input_settings_isSet = false;
soapy_sdr_input_settings = nullptr;
@ -182,6 +184,8 @@ SWGDeviceSettings::init() {
m_remote_input_settings_isSet = false;
sdr_play_settings = new SWGSDRPlaySettings();
m_sdr_play_settings_isSet = false;
sdr_play_v3_settings = new SWGSDRPlayV3Settings();
m_sdr_play_v3_settings_isSet = false;
sig_mf_file_input_settings = new SWGSigMFFileInputSettings();
m_sig_mf_file_input_settings_isSet = false;
soapy_sdr_input_settings = new SWGSoapySDRInputSettings();
@ -297,6 +301,9 @@ SWGDeviceSettings::cleanup() {
if(sdr_play_settings != nullptr) {
delete sdr_play_settings;
}
if(sdr_play_v3_settings != nullptr) {
delete sdr_play_v3_settings;
}
if(sig_mf_file_input_settings != nullptr) {
delete sig_mf_file_input_settings;
}
@ -405,6 +412,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sdr_play_settings, pJson["sdrPlaySettings"], "SWGSDRPlaySettings", "SWGSDRPlaySettings");
::SWGSDRangel::setValue(&sdr_play_v3_settings, pJson["sdrPlayV3Settings"], "SWGSDRPlayV3Settings", "SWGSDRPlayV3Settings");
::SWGSDRangel::setValue(&sig_mf_file_input_settings, pJson["sigMFFileInputSettings"], "SWGSigMFFileInputSettings", "SWGSigMFFileInputSettings");
::SWGSDRangel::setValue(&soapy_sdr_input_settings, pJson["soapySDRInputSettings"], "SWGSoapySDRInputSettings", "SWGSoapySDRInputSettings");
@ -536,6 +545,9 @@ SWGDeviceSettings::asJsonObject() {
if((sdr_play_settings != nullptr) && (sdr_play_settings->isSet())){
toJsonValue(QString("sdrPlaySettings"), sdr_play_settings, obj, QString("SWGSDRPlaySettings"));
}
if((sdr_play_v3_settings != nullptr) && (sdr_play_v3_settings->isSet())){
toJsonValue(QString("sdrPlayV3Settings"), sdr_play_v3_settings, obj, QString("SWGSDRPlayV3Settings"));
}
if((sig_mf_file_input_settings != nullptr) && (sig_mf_file_input_settings->isSet())){
toJsonValue(QString("sigMFFileInputSettings"), sig_mf_file_input_settings, obj, QString("SWGSigMFFileInputSettings"));
}
@ -883,6 +895,16 @@ SWGDeviceSettings::setSdrPlaySettings(SWGSDRPlaySettings* sdr_play_settings) {
this->m_sdr_play_settings_isSet = true;
}
SWGSDRPlayV3Settings*
SWGDeviceSettings::getSdrPlayV3Settings() {
return sdr_play_v3_settings;
}
void
SWGDeviceSettings::setSdrPlayV3Settings(SWGSDRPlayV3Settings* sdr_play_v3_settings) {
this->sdr_play_v3_settings = sdr_play_v3_settings;
this->m_sdr_play_v3_settings_isSet = true;
}
SWGSigMFFileInputSettings*
SWGDeviceSettings::getSigMfFileInputSettings() {
return sig_mf_file_input_settings;
@ -1091,6 +1113,9 @@ SWGDeviceSettings::isSet(){
if(sdr_play_settings && sdr_play_settings->isSet()){
isObjectUpdated = true; break;
}
if(sdr_play_v3_settings && sdr_play_v3_settings->isSet()){
isObjectUpdated = true; break;
}
if(sig_mf_file_input_settings && sig_mf_file_input_settings->isSet()){
isObjectUpdated = true; break;
}

Wyświetl plik

@ -50,6 +50,7 @@
#include "SWGRemoteOutputSettings.h"
#include "SWGRtlSdrSettings.h"
#include "SWGSDRPlaySettings.h"
#include "SWGSDRPlayV3Settings.h"
#include "SWGSigMFFileInputSettings.h"
#include "SWGSoapySDRInputSettings.h"
#include "SWGSoapySDROutputSettings.h"
@ -174,6 +175,9 @@ public:
SWGSDRPlaySettings* getSdrPlaySettings();
void setSdrPlaySettings(SWGSDRPlaySettings* sdr_play_settings);
SWGSDRPlayV3Settings* getSdrPlayV3Settings();
void setSdrPlayV3Settings(SWGSDRPlayV3Settings* sdr_play_v3_settings);
SWGSigMFFileInputSettings* getSigMfFileInputSettings();
void setSigMfFileInputSettings(SWGSigMFFileInputSettings* sig_mf_file_input_settings);
@ -304,6 +308,9 @@ private:
SWGSDRPlaySettings* sdr_play_settings;
bool m_sdr_play_settings_isSet;
SWGSDRPlayV3Settings* sdr_play_v3_settings;
bool m_sdr_play_v3_settings_isSet;
SWGSigMFFileInputSettings* sig_mf_file_input_settings;
bool m_sig_mf_file_input_settings_isSet;

Wyświetl plik

@ -201,6 +201,8 @@
#include "SWGRtlSdrSettings.h"
#include "SWGSDRPlayReport.h"
#include "SWGSDRPlaySettings.h"
#include "SWGSDRPlayV3Report.h"
#include "SWGSDRPlayV3Settings.h"
#include "SWGSSBDemodReport.h"
#include "SWGSSBDemodSettings.h"
#include "SWGSSBModReport.h"
@ -821,6 +823,12 @@ namespace SWGSDRangel {
if(QString("SWGSDRPlaySettings").compare(type) == 0) {
return new SWGSDRPlaySettings();
}
if(QString("SWGSDRPlayV3Report").compare(type) == 0) {
return new SWGSDRPlayV3Report();
}
if(QString("SWGSDRPlayV3Settings").compare(type) == 0) {
return new SWGSDRPlayV3Settings();
}
if(QString("SWGSSBDemodReport").compare(type) == 0) {
return new SWGSSBDemodReport();
}

Wyświetl plik

@ -0,0 +1,143 @@
/**
* 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 "SWGSDRPlayV3Report.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSDRPlayV3Report::SWGSDRPlayV3Report(QString* json) {
init();
this->fromJson(*json);
}
SWGSDRPlayV3Report::SWGSDRPlayV3Report() {
bandwidths = nullptr;
m_bandwidths_isSet = false;
intermediate_frequencies = nullptr;
m_intermediate_frequencies_isSet = false;
}
SWGSDRPlayV3Report::~SWGSDRPlayV3Report() {
this->cleanup();
}
void
SWGSDRPlayV3Report::init() {
bandwidths = new QList<SWGBandwidth*>();
m_bandwidths_isSet = false;
intermediate_frequencies = new QList<SWGFrequency*>();
m_intermediate_frequencies_isSet = false;
}
void
SWGSDRPlayV3Report::cleanup() {
if(bandwidths != nullptr) {
auto arr = bandwidths;
for(auto o: *arr) {
delete o;
}
delete bandwidths;
}
if(intermediate_frequencies != nullptr) {
auto arr = intermediate_frequencies;
for(auto o: *arr) {
delete o;
}
delete intermediate_frequencies;
}
}
SWGSDRPlayV3Report*
SWGSDRPlayV3Report::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSDRPlayV3Report::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&bandwidths, pJson["bandwidths"], "QList", "SWGBandwidth");
::SWGSDRangel::setValue(&intermediate_frequencies, pJson["intermediateFrequencies"], "QList", "SWGFrequency");
}
QString
SWGSDRPlayV3Report::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGSDRPlayV3Report::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(bandwidths && bandwidths->size() > 0){
toJsonArray((QList<void*>*)bandwidths, obj, "bandwidths", "SWGBandwidth");
}
if(intermediate_frequencies && intermediate_frequencies->size() > 0){
toJsonArray((QList<void*>*)intermediate_frequencies, obj, "intermediateFrequencies", "SWGFrequency");
}
return obj;
}
QList<SWGBandwidth*>*
SWGSDRPlayV3Report::getBandwidths() {
return bandwidths;
}
void
SWGSDRPlayV3Report::setBandwidths(QList<SWGBandwidth*>* bandwidths) {
this->bandwidths = bandwidths;
this->m_bandwidths_isSet = true;
}
QList<SWGFrequency*>*
SWGSDRPlayV3Report::getIntermediateFrequencies() {
return intermediate_frequencies;
}
void
SWGSDRPlayV3Report::setIntermediateFrequencies(QList<SWGFrequency*>* intermediate_frequencies) {
this->intermediate_frequencies = intermediate_frequencies;
this->m_intermediate_frequencies_isSet = true;
}
bool
SWGSDRPlayV3Report::isSet(){
bool isObjectUpdated = false;
do{
if(bandwidths && (bandwidths->size() > 0)){
isObjectUpdated = true; break;
}
if(intermediate_frequencies && (intermediate_frequencies->size() > 0)){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

Wyświetl plik

@ -0,0 +1,67 @@
/**
* 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.
*/
/*
* SWGSDRPlayV3Report.h
*
* SDRplayV3
*/
#ifndef SWGSDRPlayV3Report_H_
#define SWGSDRPlayV3Report_H_
#include <QJsonObject>
#include "SWGBandwidth.h"
#include "SWGFrequency.h"
#include <QList>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGSDRPlayV3Report: public SWGObject {
public:
SWGSDRPlayV3Report();
SWGSDRPlayV3Report(QString* json);
virtual ~SWGSDRPlayV3Report();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSDRPlayV3Report* fromJson(QString &jsonString) override;
QList<SWGBandwidth*>* getBandwidths();
void setBandwidths(QList<SWGBandwidth*>* bandwidths);
QList<SWGFrequency*>* getIntermediateFrequencies();
void setIntermediateFrequencies(QList<SWGFrequency*>* intermediate_frequencies);
virtual bool isSet() override;
private:
QList<SWGBandwidth*>* bandwidths;
bool m_bandwidths_isSet;
QList<SWGFrequency*>* intermediate_frequencies;
bool m_intermediate_frequencies_isSet;
};
}
#endif /* SWGSDRPlayV3Report_H_ */

Wyświetl plik

@ -0,0 +1,593 @@
/**
* 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 "SWGSDRPlayV3Settings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSDRPlayV3Settings::SWGSDRPlayV3Settings(QString* json) {
init();
this->fromJson(*json);
}
SWGSDRPlayV3Settings::SWGSDRPlayV3Settings() {
center_frequency = 0L;
m_center_frequency_isSet = false;
l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
if_frequency_index = 0;
m_if_frequency_index_isSet = false;
bandwidth_index = 0;
m_bandwidth_index_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0;
m_fc_pos_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0;
m_iq_correction_isSet = false;
lna_index = 0;
m_lna_index_isSet = false;
if_agc = 0;
m_if_agc_isSet = false;
if_gain = 0;
m_if_gain_isSet = false;
am_notch = 0;
m_am_notch_isSet = false;
fm_notch = 0;
m_fm_notch_isSet = false;
dab_notch = 0;
m_dab_notch_isSet = false;
ext_ref = 0;
m_ext_ref_isSet = false;
tuner = 0;
m_tuner_isSet = false;
antenna = 0;
m_antenna_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = nullptr;
m_reverse_api_address_isSet = false;
reverse_api_port = 0;
m_reverse_api_port_isSet = false;
reverse_api_device_index = 0;
m_reverse_api_device_index_isSet = false;
}
SWGSDRPlayV3Settings::~SWGSDRPlayV3Settings() {
this->cleanup();
}
void
SWGSDRPlayV3Settings::init() {
center_frequency = 0L;
m_center_frequency_isSet = false;
l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
if_frequency_index = 0;
m_if_frequency_index_isSet = false;
bandwidth_index = 0;
m_bandwidth_index_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0;
m_fc_pos_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0;
m_iq_correction_isSet = false;
lna_index = 0;
m_lna_index_isSet = false;
if_agc = 0;
m_if_agc_isSet = false;
if_gain = 0;
m_if_gain_isSet = false;
am_notch = 0;
m_am_notch_isSet = false;
fm_notch = 0;
m_fm_notch_isSet = false;
dab_notch = 0;
m_dab_notch_isSet = false;
ext_ref = 0;
m_ext_ref_isSet = false;
tuner = 0;
m_tuner_isSet = false;
antenna = 0;
m_antenna_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = new QString("");
m_reverse_api_address_isSet = false;
reverse_api_port = 0;
m_reverse_api_port_isSet = false;
reverse_api_device_index = 0;
m_reverse_api_device_index_isSet = false;
}
void
SWGSDRPlayV3Settings::cleanup() {
if(reverse_api_address != nullptr) {
delete reverse_api_address;
}
}
SWGSDRPlayV3Settings*
SWGSDRPlayV3Settings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSDRPlayV3Settings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
::SWGSDRangel::setValue(&if_frequency_index, pJson["ifFrequencyIndex"], "qint32", "");
::SWGSDRangel::setValue(&bandwidth_index, pJson["bandwidthIndex"], "qint32", "");
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
::SWGSDRangel::setValue(&lna_index, pJson["lnaIndex"], "qint32", "");
::SWGSDRangel::setValue(&if_agc, pJson["ifAGC"], "qint32", "");
::SWGSDRangel::setValue(&if_gain, pJson["ifGain"], "qint32", "");
::SWGSDRangel::setValue(&am_notch, pJson["amNotch"], "qint32", "");
::SWGSDRangel::setValue(&fm_notch, pJson["fmNotch"], "qint32", "");
::SWGSDRangel::setValue(&dab_notch, pJson["dabNotch"], "qint32", "");
::SWGSDRangel::setValue(&ext_ref, pJson["extRef"], "qint32", "");
::SWGSDRangel::setValue(&tuner, pJson["tuner"], "qint32", "");
::SWGSDRangel::setValue(&antenna, pJson["antenna"], "qint32", "");
::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
}
QString
SWGSDRPlayV3Settings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGSDRPlayV3Settings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency));
}
if(m_l_oppm_tenths_isSet){
obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
}
if(m_if_frequency_index_isSet){
obj->insert("ifFrequencyIndex", QJsonValue(if_frequency_index));
}
if(m_bandwidth_index_isSet){
obj->insert("bandwidthIndex", QJsonValue(bandwidth_index));
}
if(m_dev_sample_rate_isSet){
obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
}
if(m_log2_decim_isSet){
obj->insert("log2Decim", QJsonValue(log2_decim));
}
if(m_fc_pos_isSet){
obj->insert("fcPos", QJsonValue(fc_pos));
}
if(m_dc_block_isSet){
obj->insert("dcBlock", QJsonValue(dc_block));
}
if(m_iq_correction_isSet){
obj->insert("iqCorrection", QJsonValue(iq_correction));
}
if(m_lna_index_isSet){
obj->insert("lnaIndex", QJsonValue(lna_index));
}
if(m_if_agc_isSet){
obj->insert("ifAGC", QJsonValue(if_agc));
}
if(m_if_gain_isSet){
obj->insert("ifGain", QJsonValue(if_gain));
}
if(m_am_notch_isSet){
obj->insert("amNotch", QJsonValue(am_notch));
}
if(m_fm_notch_isSet){
obj->insert("fmNotch", QJsonValue(fm_notch));
}
if(m_dab_notch_isSet){
obj->insert("dabNotch", QJsonValue(dab_notch));
}
if(m_ext_ref_isSet){
obj->insert("extRef", QJsonValue(ext_ref));
}
if(m_tuner_isSet){
obj->insert("tuner", QJsonValue(tuner));
}
if(m_antenna_isSet){
obj->insert("antenna", QJsonValue(antenna));
}
if(m_use_reverse_api_isSet){
obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
}
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
}
if(m_reverse_api_port_isSet){
obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
}
if(m_reverse_api_device_index_isSet){
obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
}
return obj;
}
qint64
SWGSDRPlayV3Settings::getCenterFrequency() {
return center_frequency;
}
void
SWGSDRPlayV3Settings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getLOppmTenths() {
return l_oppm_tenths;
}
void
SWGSDRPlayV3Settings::setLOppmTenths(qint32 l_oppm_tenths) {
this->l_oppm_tenths = l_oppm_tenths;
this->m_l_oppm_tenths_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getIfFrequencyIndex() {
return if_frequency_index;
}
void
SWGSDRPlayV3Settings::setIfFrequencyIndex(qint32 if_frequency_index) {
this->if_frequency_index = if_frequency_index;
this->m_if_frequency_index_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getBandwidthIndex() {
return bandwidth_index;
}
void
SWGSDRPlayV3Settings::setBandwidthIndex(qint32 bandwidth_index) {
this->bandwidth_index = bandwidth_index;
this->m_bandwidth_index_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getDevSampleRate() {
return dev_sample_rate;
}
void
SWGSDRPlayV3Settings::setDevSampleRate(qint32 dev_sample_rate) {
this->dev_sample_rate = dev_sample_rate;
this->m_dev_sample_rate_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getLog2Decim() {
return log2_decim;
}
void
SWGSDRPlayV3Settings::setLog2Decim(qint32 log2_decim) {
this->log2_decim = log2_decim;
this->m_log2_decim_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getFcPos() {
return fc_pos;
}
void
SWGSDRPlayV3Settings::setFcPos(qint32 fc_pos) {
this->fc_pos = fc_pos;
this->m_fc_pos_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getDcBlock() {
return dc_block;
}
void
SWGSDRPlayV3Settings::setDcBlock(qint32 dc_block) {
this->dc_block = dc_block;
this->m_dc_block_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getIqCorrection() {
return iq_correction;
}
void
SWGSDRPlayV3Settings::setIqCorrection(qint32 iq_correction) {
this->iq_correction = iq_correction;
this->m_iq_correction_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getLnaIndex() {
return lna_index;
}
void
SWGSDRPlayV3Settings::setLnaIndex(qint32 lna_index) {
this->lna_index = lna_index;
this->m_lna_index_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getIfAgc() {
return if_agc;
}
void
SWGSDRPlayV3Settings::setIfAgc(qint32 if_agc) {
this->if_agc = if_agc;
this->m_if_agc_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getIfGain() {
return if_gain;
}
void
SWGSDRPlayV3Settings::setIfGain(qint32 if_gain) {
this->if_gain = if_gain;
this->m_if_gain_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getAmNotch() {
return am_notch;
}
void
SWGSDRPlayV3Settings::setAmNotch(qint32 am_notch) {
this->am_notch = am_notch;
this->m_am_notch_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getFmNotch() {
return fm_notch;
}
void
SWGSDRPlayV3Settings::setFmNotch(qint32 fm_notch) {
this->fm_notch = fm_notch;
this->m_fm_notch_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getDabNotch() {
return dab_notch;
}
void
SWGSDRPlayV3Settings::setDabNotch(qint32 dab_notch) {
this->dab_notch = dab_notch;
this->m_dab_notch_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getExtRef() {
return ext_ref;
}
void
SWGSDRPlayV3Settings::setExtRef(qint32 ext_ref) {
this->ext_ref = ext_ref;
this->m_ext_ref_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getTuner() {
return tuner;
}
void
SWGSDRPlayV3Settings::setTuner(qint32 tuner) {
this->tuner = tuner;
this->m_tuner_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getAntenna() {
return antenna;
}
void
SWGSDRPlayV3Settings::setAntenna(qint32 antenna) {
this->antenna = antenna;
this->m_antenna_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getUseReverseApi() {
return use_reverse_api;
}
void
SWGSDRPlayV3Settings::setUseReverseApi(qint32 use_reverse_api) {
this->use_reverse_api = use_reverse_api;
this->m_use_reverse_api_isSet = true;
}
QString*
SWGSDRPlayV3Settings::getReverseApiAddress() {
return reverse_api_address;
}
void
SWGSDRPlayV3Settings::setReverseApiAddress(QString* reverse_api_address) {
this->reverse_api_address = reverse_api_address;
this->m_reverse_api_address_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getReverseApiPort() {
return reverse_api_port;
}
void
SWGSDRPlayV3Settings::setReverseApiPort(qint32 reverse_api_port) {
this->reverse_api_port = reverse_api_port;
this->m_reverse_api_port_isSet = true;
}
qint32
SWGSDRPlayV3Settings::getReverseApiDeviceIndex() {
return reverse_api_device_index;
}
void
SWGSDRPlayV3Settings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) {
this->reverse_api_device_index = reverse_api_device_index;
this->m_reverse_api_device_index_isSet = true;
}
bool
SWGSDRPlayV3Settings::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){
isObjectUpdated = true; break;
}
if(m_l_oppm_tenths_isSet){
isObjectUpdated = true; break;
}
if(m_if_frequency_index_isSet){
isObjectUpdated = true; break;
}
if(m_bandwidth_index_isSet){
isObjectUpdated = true; break;
}
if(m_dev_sample_rate_isSet){
isObjectUpdated = true; break;
}
if(m_log2_decim_isSet){
isObjectUpdated = true; break;
}
if(m_fc_pos_isSet){
isObjectUpdated = true; break;
}
if(m_dc_block_isSet){
isObjectUpdated = true; break;
}
if(m_iq_correction_isSet){
isObjectUpdated = true; break;
}
if(m_lna_index_isSet){
isObjectUpdated = true; break;
}
if(m_if_agc_isSet){
isObjectUpdated = true; break;
}
if(m_if_gain_isSet){
isObjectUpdated = true; break;
}
if(m_am_notch_isSet){
isObjectUpdated = true; break;
}
if(m_fm_notch_isSet){
isObjectUpdated = true; break;
}
if(m_dab_notch_isSet){
isObjectUpdated = true; break;
}
if(m_ext_ref_isSet){
isObjectUpdated = true; break;
}
if(m_tuner_isSet){
isObjectUpdated = true; break;
}
if(m_antenna_isSet){
isObjectUpdated = true; break;
}
if(m_use_reverse_api_isSet){
isObjectUpdated = true; break;
}
if(reverse_api_address && *reverse_api_address != QString("")){
isObjectUpdated = true; break;
}
if(m_reverse_api_port_isSet){
isObjectUpdated = true; break;
}
if(m_reverse_api_device_index_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

Wyświetl plik

@ -0,0 +1,185 @@
/**
* 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.
*/
/*
* SWGSDRPlayV3Settings.h
*
* SDRplayV3
*/
#ifndef SWGSDRPlayV3Settings_H_
#define SWGSDRPlayV3Settings_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGSDRPlayV3Settings: public SWGObject {
public:
SWGSDRPlayV3Settings();
SWGSDRPlayV3Settings(QString* json);
virtual ~SWGSDRPlayV3Settings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSDRPlayV3Settings* fromJson(QString &jsonString) override;
qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency);
qint32 getLOppmTenths();
void setLOppmTenths(qint32 l_oppm_tenths);
qint32 getIfFrequencyIndex();
void setIfFrequencyIndex(qint32 if_frequency_index);
qint32 getBandwidthIndex();
void setBandwidthIndex(qint32 bandwidth_index);
qint32 getDevSampleRate();
void setDevSampleRate(qint32 dev_sample_rate);
qint32 getLog2Decim();
void setLog2Decim(qint32 log2_decim);
qint32 getFcPos();
void setFcPos(qint32 fc_pos);
qint32 getDcBlock();
void setDcBlock(qint32 dc_block);
qint32 getIqCorrection();
void setIqCorrection(qint32 iq_correction);
qint32 getLnaIndex();
void setLnaIndex(qint32 lna_index);
qint32 getIfAgc();
void setIfAgc(qint32 if_agc);
qint32 getIfGain();
void setIfGain(qint32 if_gain);
qint32 getAmNotch();
void setAmNotch(qint32 am_notch);
qint32 getFmNotch();
void setFmNotch(qint32 fm_notch);
qint32 getDabNotch();
void setDabNotch(qint32 dab_notch);
qint32 getExtRef();
void setExtRef(qint32 ext_ref);
qint32 getTuner();
void setTuner(qint32 tuner);
qint32 getAntenna();
void setAntenna(qint32 antenna);
qint32 getUseReverseApi();
void setUseReverseApi(qint32 use_reverse_api);
QString* getReverseApiAddress();
void setReverseApiAddress(QString* reverse_api_address);
qint32 getReverseApiPort();
void setReverseApiPort(qint32 reverse_api_port);
qint32 getReverseApiDeviceIndex();
void setReverseApiDeviceIndex(qint32 reverse_api_device_index);
virtual bool isSet() override;
private:
qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 l_oppm_tenths;
bool m_l_oppm_tenths_isSet;
qint32 if_frequency_index;
bool m_if_frequency_index_isSet;
qint32 bandwidth_index;
bool m_bandwidth_index_isSet;
qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 log2_decim;
bool m_log2_decim_isSet;
qint32 fc_pos;
bool m_fc_pos_isSet;
qint32 dc_block;
bool m_dc_block_isSet;
qint32 iq_correction;
bool m_iq_correction_isSet;
qint32 lna_index;
bool m_lna_index_isSet;
qint32 if_agc;
bool m_if_agc_isSet;
qint32 if_gain;
bool m_if_gain_isSet;
qint32 am_notch;
bool m_am_notch_isSet;
qint32 fm_notch;
bool m_fm_notch_isSet;
qint32 dab_notch;
bool m_dab_notch_isSet;
qint32 ext_ref;
bool m_ext_ref_isSet;
qint32 tuner;
bool m_tuner_isSet;
qint32 antenna;
bool m_antenna_isSet;
qint32 use_reverse_api;
bool m_use_reverse_api_isSet;
QString* reverse_api_address;
bool m_reverse_api_address_isSet;
qint32 reverse_api_port;
bool m_reverse_api_port_isSet;
qint32 reverse_api_device_index;
bool m_reverse_api_device_index_isSet;
};
}
#endif /* SWGSDRPlayV3Settings_H_ */