From 7500932c7cb2c12e38dda986c666fd2ab5be634e Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 18 May 2021 01:52:25 +0200 Subject: [PATCH] File Output: make file name persistent. Completed REST API. AIS: added REST API missing doc files --- plugins/samplesink/fileoutput/CMakeLists.txt | 6 +- plugins/samplesink/fileoutput/fileoutput.cpp | 222 +++++++++++- plugins/samplesink/fileoutput/fileoutput.h | 30 +- .../samplesink/fileoutput/fileoutputgui.cpp | 12 +- plugins/samplesink/fileoutput/fileoutputgui.h | 1 - .../fileoutput/fileoutputsettings.cpp | 26 ++ .../fileoutput/fileoutputsettings.h | 5 + .../fileoutput/fileoutputwebapiadapter.cpp | 52 +++ .../fileoutput/fileoutputwebapiadapter.h | 44 +++ sdrbase/resources/webapi.qrc | 5 + sdrbase/resources/webapi/doc/html2/index.html | 339 +++++++++++++++++- .../webapi/doc/swagger/include/AIS.yaml | 18 + .../webapi/doc/swagger/include/AISDemod.yaml | 55 +++ .../webapi/doc/swagger/include/AISMod.yaml | 125 +++++++ .../doc/swagger/include/ChannelActions.yaml | 2 + .../doc/swagger/include/ChannelReport.yaml | 4 + .../doc/swagger/include/ChannelSettings.yaml | 4 + .../doc/swagger/include/DeviceSettings.yaml | 2 + .../doc/swagger/include/FeatureSettings.yaml | 2 + .../doc/swagger/include/FileOutput.yaml | 23 ++ sdrbase/webapi/webapirequestmapper.cpp | 6 + sdrbase/webapi/webapiutils.cpp | 1 + .../api/swagger/include/DeviceSettings.yaml | 2 + .../api/swagger/include/FileOutput.yaml | 23 ++ swagger/sdrangel/code/html2/index.html | 339 +++++++++++++++++- .../code/qt5/client/SWGDeviceSettings.cpp | 25 ++ .../code/qt5/client/SWGDeviceSettings.h | 7 + .../code/qt5/client/SWGFileOutputSettings.cpp | 273 ++++++++++++++ .../code/qt5/client/SWGFileOutputSettings.h | 101 ++++++ .../code/qt5/client/SWGModelFactory.h | 4 + 30 files changed, 1731 insertions(+), 27 deletions(-) create mode 100644 plugins/samplesink/fileoutput/fileoutputwebapiadapter.cpp create mode 100644 plugins/samplesink/fileoutput/fileoutputwebapiadapter.h create mode 100644 sdrbase/resources/webapi/doc/swagger/include/AIS.yaml create mode 100644 sdrbase/resources/webapi/doc/swagger/include/AISDemod.yaml create mode 100644 sdrbase/resources/webapi/doc/swagger/include/AISMod.yaml create mode 100644 sdrbase/resources/webapi/doc/swagger/include/FileOutput.yaml create mode 100644 swagger/sdrangel/api/swagger/include/FileOutput.yaml create mode 100644 swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.h diff --git a/plugins/samplesink/fileoutput/CMakeLists.txt b/plugins/samplesink/fileoutput/CMakeLists.txt index f0504eec4..af06b3134 100644 --- a/plugins/samplesink/fileoutput/CMakeLists.txt +++ b/plugins/samplesink/fileoutput/CMakeLists.txt @@ -4,14 +4,16 @@ set(fileoutput_SOURCES fileoutput.cpp fileoutputplugin.cpp fileoutputsettings.cpp - fileoutputworker.cpp + fileoutputworker.cpp + fileoutputwebapiadapter.cpp ) set(fileoutput_HEADERS fileoutput.h fileoutputplugin.h fileoutputsettings.h - fileoutputworker.h + fileoutputworker.h + fileoutputwebapiadapter.h ) include_directories( diff --git a/plugins/samplesink/fileoutput/fileoutput.cpp b/plugins/samplesink/fileoutput/fileoutput.cpp index c4d2a86f4..718aed34d 100644 --- a/plugins/samplesink/fileoutput/fileoutput.cpp +++ b/plugins/samplesink/fileoutput/fileoutput.cpp @@ -17,6 +17,8 @@ #include #include +#include +#include #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" @@ -44,7 +46,6 @@ FileOutput::FileOutput(DeviceAPI *deviceAPI) : m_settings(), m_fileOutputWorker(nullptr), m_deviceDescription("FileOutput"), - m_fileName("./test.sdriq"), m_startingTimeStamp(0), m_masterTimer(deviceAPI->getMasterTimer()) { @@ -67,7 +68,7 @@ void FileOutput::openFileStream() m_ofstream.close(); } - m_ofstream.open(m_fileName.toStdString().c_str(), std::ios::binary); + m_ofstream.open(m_settings.m_fileName.toStdString().c_str(), std::ios::binary); FileRecord::Header header; int actualSampleRate = m_settings.m_sampleRate * (1<stopDeviceEngine(); } + if (m_settings.m_useReverseAPI) { + webapiReverseSendStartStop(cmd.getStartStop()); + } + return true; } else if (MsgConfigureFileOutput::match(message)) @@ -285,37 +290,49 @@ void FileOutput::applySettings(const FileOutputSettings& settings, bool force) { QMutexLocker mutexLocker(&m_mutex); bool forwardChange = false; + QList reverseAPIKeys; + + if (force || (m_settings.m_fileName != settings.m_fileName)) { + reverseAPIKeys.append("fileName"); + } if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) { - m_settings.m_centerFrequency = settings.m_centerFrequency; + reverseAPIKeys.append("centerFrequency"); forwardChange = true; } if (force || (m_settings.m_sampleRate != settings.m_sampleRate)) { - m_settings.m_sampleRate = settings.m_sampleRate; - - if (m_fileOutputWorker != 0) - { - m_fileOutputWorker->setSamplerate(m_settings.m_sampleRate); + if (m_fileOutputWorker != 0) { + m_fileOutputWorker->setSamplerate(settings.m_sampleRate); } + reverseAPIKeys.append("sampleRate"); forwardChange = true; } if (force || (m_settings.m_log2Interp != settings.m_log2Interp)) { - m_settings.m_log2Interp = settings.m_log2Interp; - - if (m_fileOutputWorker != 0) - { - m_fileOutputWorker->setLog2Interpolation(m_settings.m_log2Interp); + if (m_fileOutputWorker != 0) { + m_fileOutputWorker->setLog2Interpolation(settings.m_log2Interp); } + reverseAPIKeys.append("log2Interp"); forwardChange = true; } + if (settings.m_useReverseAPI) + { + bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) || + (m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) || + (m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) || + (m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex); + webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force); + } + + m_settings = settings; + if (forwardChange) { qDebug("FileOutput::applySettings: forward: m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d", @@ -325,7 +342,40 @@ void FileOutput::applySettings(const FileOutputSettings& settings, bool force) DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate, m_settings.m_centerFrequency); m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif); } +} +int FileOutput::webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setFileOutputSettings(new SWGSDRangel::SWGFileOutputSettings()); + response.getFileOutputSettings()->init(); + webapiFormatDeviceSettings(response, m_settings); + return 200; +} + +int FileOutput::webapiSettingsPutPatch( + bool force, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response, // query + response + QString& errorMessage) +{ + (void) errorMessage; + FileOutputSettings settings = m_settings; + webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response); + + MsgConfigureFileOutput *msg = MsgConfigureFileOutput::create(settings, force); + m_inputMessageQueue.push(msg); + + if (m_guiMessageQueue) // forward to GUI if any + { + MsgConfigureFileOutput *msgToGUI = MsgConfigureFileOutput::create(settings, force); + m_guiMessageQueue->push(msgToGUI); + } + + webapiFormatDeviceSettings(response, settings); + return 200; } int FileOutput::webapiRunGet( @@ -356,4 +406,146 @@ int FileOutput::webapiRun( return 200; } +void FileOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const FileOutputSettings& settings) +{ + response.getFileOutputSettings()->setFileName(new QString(settings.m_fileName)); + response.getFileOutputSettings()->setCenterFrequency(settings.m_centerFrequency); + response.getFileOutputSettings()->setSampleRate(settings.m_sampleRate); + response.getFileOutputSettings()->setLog2Interp(settings.m_log2Interp); + response.getFileOutputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); + + if (response.getFileOutputSettings()->getReverseApiAddress()) { + *response.getFileOutputSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress; + } else { + response.getFileOutputSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress)); + } + + response.getFileOutputSettings()->setReverseApiPort(settings.m_reverseAPIPort); + response.getFileOutputSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); +} + +void FileOutput::webapiUpdateDeviceSettings( + FileOutputSettings& settings, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response) +{ + if (deviceSettingsKeys.contains("fileName")) { + settings.m_fileName = *response.getFileOutputSettings()->getFileName(); + } + if (deviceSettingsKeys.contains("centerFrequency")) { + settings.m_centerFrequency = response.getFileOutputSettings()->getCenterFrequency(); + } + if (deviceSettingsKeys.contains("sampleRate")) { + settings.m_sampleRate = response.getFileOutputSettings()->getSampleRate(); + } + if (deviceSettingsKeys.contains("log2Interp")) { + settings.m_log2Interp = response.getFileOutputSettings()->getLog2Interp(); + } + if (deviceSettingsKeys.contains("useReverseAPI")) { + settings.m_useReverseAPI = response.getFileOutputSettings()->getUseReverseApi() != 0; + } + if (deviceSettingsKeys.contains("reverseAPIAddress")) { + settings.m_reverseAPIAddress = *response.getFileOutputSettings()->getReverseApiAddress(); + } + if (deviceSettingsKeys.contains("reverseAPIPort")) { + settings.m_reverseAPIPort = response.getFileOutputSettings()->getReverseApiPort(); + } + if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) { + settings.m_reverseAPIDeviceIndex = response.getFileOutputSettings()->getReverseApiDeviceIndex(); + } +} + +void FileOutput::webapiReverseSendSettings(QList& deviceSettingsKeys, const FileOutputSettings& settings, bool force) +{ + SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); + swgDeviceSettings->setDirection(1); // single Tx + swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex()); + swgDeviceSettings->setDeviceHwType(new QString("FileOutput")); + swgDeviceSettings->setFileOutputSettings(new SWGSDRangel::SWGFileOutputSettings()); + SWGSDRangel::SWGFileOutputSettings *swgFileOutputSettings = swgDeviceSettings->getFileOutputSettings(); + + // transfer data that has been modified. When force is on transfer all data except reverse API data + + if (deviceSettingsKeys.contains("centerFrequency") || force) { + swgFileOutputSettings->setCenterFrequency(settings.m_centerFrequency); + } + if (deviceSettingsKeys.contains("sampleRate") || force) { + swgFileOutputSettings->setSampleRate(settings.m_sampleRate); + } + if (deviceSettingsKeys.contains("log2Interp") || force) { + swgFileOutputSettings->setLog2Interp(settings.m_log2Interp); + } + if (deviceSettingsKeys.contains("fileName") || force) { + swgFileOutputSettings->setFileName(new QString(settings.m_fileName)); + } + + QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings") + .arg(settings.m_reverseAPIAddress) + .arg(settings.m_reverseAPIPort) + .arg(settings.m_reverseAPIDeviceIndex); + m_networkRequest.setUrl(QUrl(deviceSettingsURL)); + m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + QBuffer *buffer = new QBuffer(); + buffer->open((QBuffer::ReadWrite)); + buffer->write(swgDeviceSettings->asJson().toUtf8()); + buffer->seek(0); + + // Always use PATCH to avoid passing reverse API settings + QNetworkReply *reply = m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer); + buffer->setParent(reply); + + delete swgDeviceSettings; +} + +void FileOutput::webapiReverseSendStartStop(bool start) +{ + SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); + swgDeviceSettings->setDirection(1); // single Tx + swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex()); + swgDeviceSettings->setDeviceHwType(new QString("FileOutput")); + + QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run") + .arg(m_settings.m_reverseAPIAddress) + .arg(m_settings.m_reverseAPIPort) + .arg(m_settings.m_reverseAPIDeviceIndex); + m_networkRequest.setUrl(QUrl(deviceSettingsURL)); + m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + QBuffer *buffer = new QBuffer(); + buffer->open((QBuffer::ReadWrite)); + buffer->write(swgDeviceSettings->asJson().toUtf8()); + buffer->seek(0); + QNetworkReply *reply; + + if (start) { + reply = m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer); + } else { + reply = m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer); + } + + buffer->setParent(reply); + delete swgDeviceSettings; +} + +void FileOutput::networkManagerFinished(QNetworkReply *reply) +{ + QNetworkReply::NetworkError replyError = reply->error(); + + if (replyError) + { + qWarning() << "FileOutput::networkManagerFinished:" + << " error(" << (int) replyError + << "): " << replyError + << ": " << reply->errorString(); + } + else + { + QString answer = reply->readAll(); + answer.chop(1); // remove last \n + qDebug("FileOutput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str()); + } + + reply->deleteLater(); +} diff --git a/plugins/samplesink/fileoutput/fileoutput.h b/plugins/samplesink/fileoutput/fileoutput.h index 7142656b8..3863419fc 100644 --- a/plugins/samplesink/fileoutput/fileoutput.h +++ b/plugins/samplesink/fileoutput/fileoutput.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,8 @@ #include "dsp/devicesamplesink.h" #include "fileoutputsettings.h" +class QNetworkAccessManager; +class QNetworkReply; class FileOutputWorker; class DeviceAPI; @@ -194,6 +197,16 @@ public: 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 webapiRunGet( SWGSDRangel::SWGDeviceState& response, QString& errorMessage); @@ -203,6 +216,15 @@ public: SWGSDRangel::SWGDeviceState& response, QString& errorMessage); + static void webapiFormatDeviceSettings( + SWGSDRangel::SWGDeviceSettings& response, + const FileOutputSettings& settings); + + static void webapiUpdateDeviceSettings( + FileOutputSettings& settings, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response); + private: DeviceAPI *m_deviceAPI; QMutex m_mutex; @@ -211,14 +233,20 @@ private: FileOutputWorker* m_fileOutputWorker; QThread m_fileOutputWorkerThread; QString m_deviceDescription; - QString m_fileName; std::time_t m_startingTimeStamp; const QTimer& m_masterTimer; + QNetworkAccessManager *m_networkManager; + QNetworkRequest m_networkRequest; void startWorker(); void stopWorker(); void openFileStream(); void applySettings(const FileOutputSettings& settings, bool force = false); + void webapiReverseSendSettings(QList& deviceSettingsKeys, const FileOutputSettings& settings, bool force); + void webapiReverseSendStartStop(bool start); + +private slots: + void networkManagerFinished(QNetworkReply *reply); }; #endif // INCLUDE_FILEOUTPUT_H diff --git a/plugins/samplesink/fileoutput/fileoutputgui.cpp b/plugins/samplesink/fileoutput/fileoutputgui.cpp index 20a5a2126..3a06d16e0 100644 --- a/plugins/samplesink/fileoutput/fileoutputgui.cpp +++ b/plugins/samplesink/fileoutput/fileoutputgui.cpp @@ -43,7 +43,6 @@ FileOutputGui::FileOutputGui(DeviceUISet *deviceUISet, QWidget* parent) : m_doApplySettings(true), m_forceSettings(true), m_settings(), - m_fileName("./test.sdriq"), m_deviceSampleSink(0), m_sampleRate(0), m_generation(false), @@ -60,7 +59,7 @@ FileOutputGui::FileOutputGui(DeviceUISet *deviceUISet, QWidget* parent) : ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); ui->sampleRate->setValueRange(8, 32000U, 90000000U); - ui->fileNameText->setText(m_fileName); + ui->fileNameText->setText(m_settings.m_fileName); connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); @@ -186,6 +185,7 @@ void FileOutputGui::displaySettings() { ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->sampleRate->setValue(m_settings.m_sampleRate); + ui->fileNameText->setText(m_settings.m_fileName); } void FileOutputGui::sendSettings() @@ -273,16 +273,16 @@ void FileOutputGui::on_showFileDialog_clicked(bool checked) if (fileName != "") { - m_fileName = fileName; - ui->fileNameText->setText(m_fileName); + m_settings.m_fileName = fileName; + ui->fileNameText->setText(m_settings.m_fileName); configureFileName(); } } void FileOutputGui::configureFileName() { - qDebug() << "FileOutputGui::configureFileName: " << m_fileName.toStdString().c_str(); - FileOutput::MsgConfigureFileOutputName* message = FileOutput::MsgConfigureFileOutputName::create(m_fileName); + qDebug() << "FileOutputGui::configureFileName: " << m_settings.m_fileName.toStdString().c_str(); + FileOutput::MsgConfigureFileOutputName* message = FileOutput::MsgConfigureFileOutputName::create(m_settings.m_fileName); m_deviceSampleSink->getInputMessageQueue()->push(message); } diff --git a/plugins/samplesink/fileoutput/fileoutputgui.h b/plugins/samplesink/fileoutput/fileoutputgui.h index fa44b5d08..0b8061bbb 100644 --- a/plugins/samplesink/fileoutput/fileoutputgui.h +++ b/plugins/samplesink/fileoutput/fileoutputgui.h @@ -55,7 +55,6 @@ private: bool m_doApplySettings; bool m_forceSettings; FileOutputSettings m_settings; - QString m_fileName; QTimer m_updateTimer; QTimer m_statusTimer; DeviceSampleSink* m_deviceSampleSink; diff --git a/plugins/samplesink/fileoutput/fileoutputsettings.cpp b/plugins/samplesink/fileoutput/fileoutputsettings.cpp index cdd1fad60..a4affa826 100644 --- a/plugins/samplesink/fileoutput/fileoutputsettings.cpp +++ b/plugins/samplesink/fileoutput/fileoutputsettings.cpp @@ -28,6 +28,11 @@ void FileOutputSettings::resetToDefaults() m_centerFrequency = 435000*1000; m_sampleRate = 48000; m_log2Interp = 0; + m_fileName = "./test.sdriq"; + m_useReverseAPI = false; + m_reverseAPIAddress = "127.0.0.1"; + m_reverseAPIPort = 8888; + m_reverseAPIDeviceIndex = 0; } QByteArray FileOutputSettings::serialize() const @@ -36,6 +41,11 @@ QByteArray FileOutputSettings::serialize() const s.writeU64(1, m_sampleRate); s.writeU32(2, m_log2Interp); + s.writeString(3, m_fileName); + s.writeBool(4, m_useReverseAPI); + s.writeString(5, m_reverseAPIAddress); + s.writeU32(6, m_reverseAPIPort); + s.writeU32(7, m_reverseAPIDeviceIndex); return s.final(); } @@ -52,8 +62,24 @@ bool FileOutputSettings::deserialize(const QByteArray& data) if (d.getVersion() == 1) { + unsigned int uintval; + d.readU64(1, &m_sampleRate, 48000); d.readU32(2, &m_log2Interp, 0); + d.readString(3, &m_fileName, "./test.sdriq"); + d.readBool(4, &m_useReverseAPI, false); + d.readString(5, &m_reverseAPIAddress, "127.0.0.1"); + d.readU32(6, &uintval, 0); + + if ((uintval > 1023) && (uintval < 65535)) { + m_reverseAPIPort = uintval; + } else { + m_reverseAPIPort = 8888; + } + + d.readU32(7, &uintval, 0); + m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval; + return true; } else diff --git a/plugins/samplesink/fileoutput/fileoutputsettings.h b/plugins/samplesink/fileoutput/fileoutputsettings.h index 91d593fa4..3b6b666c4 100644 --- a/plugins/samplesink/fileoutput/fileoutputsettings.h +++ b/plugins/samplesink/fileoutput/fileoutputsettings.h @@ -24,6 +24,11 @@ struct FileOutputSettings { quint64 m_centerFrequency; quint64 m_sampleRate; quint32 m_log2Interp; + QString m_fileName; + bool m_useReverseAPI; + QString m_reverseAPIAddress; + uint16_t m_reverseAPIPort; + uint16_t m_reverseAPIDeviceIndex; FileOutputSettings(); void resetToDefaults(); diff --git a/plugins/samplesink/fileoutput/fileoutputwebapiadapter.cpp b/plugins/samplesink/fileoutput/fileoutputwebapiadapter.cpp new file mode 100644 index 000000000..85ccd8a80 --- /dev/null +++ b/plugins/samplesink/fileoutput/fileoutputwebapiadapter.cpp @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2019 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "SWGDeviceSettings.h" +#include "fileoutput.h" +#include "fileoutputwebapiadapter.h" + +FileOutputWebAPIAdapter::FileOutputWebAPIAdapter() +{} + +FileOutputWebAPIAdapter::~FileOutputWebAPIAdapter() +{} + +int FileOutputWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setFileOutputSettings(new SWGSDRangel::SWGFileOutputSettings()); + response.getFileOutputSettings()->init(); + FileOutput::webapiFormatDeviceSettings(response, m_settings); + return 200; +} + +int FileOutputWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response, // query + response + QString& errorMessage) +{ + (void) force; // no action + (void) errorMessage; + FileOutput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response); + return 200; +} diff --git a/plugins/samplesink/fileoutput/fileoutputwebapiadapter.h b/plugins/samplesink/fileoutput/fileoutputwebapiadapter.h new file mode 100644 index 000000000..f01264dff --- /dev/null +++ b/plugins/samplesink/fileoutput/fileoutputwebapiadapter.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2019 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "device/devicewebapiadapter.h" +#include "fileoutputsettings.h" + +class FileOutputWebAPIAdapter : public DeviceWebAPIAdapter +{ +public: + FileOutputWebAPIAdapter(); + virtual ~FileOutputWebAPIAdapter(); + 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: + FileOutputSettings m_settings; +}; diff --git a/sdrbase/resources/webapi.qrc b/sdrbase/resources/webapi.qrc index fb136652f..e6a98f48b 100644 --- a/sdrbase/resources/webapi.qrc +++ b/sdrbase/resources/webapi.qrc @@ -6,6 +6,9 @@ webapi/doc/swagger/include/AFC.yaml webapi/doc/swagger/include/Airspy.yaml webapi/doc/swagger/include/AirspyHF.yaml + webapi/doc/swagger/include/AIS.yaml + webapi/doc/swagger/include/AISDemod.yaml + webapi/doc/swagger/include/AISMod.yaml webapi/doc/swagger/include/AMDemod.yaml webapi/doc/swagger/include/AMMod.yaml webapi/doc/swagger/include/ATVDemod.yaml @@ -39,6 +42,7 @@ webapi/doc/swagger/include/FileSink.yaml webapi/doc/swagger/include/FileSource.yaml webapi/doc/swagger/include/FileInput.yaml + webapi/doc/swagger/include/FileOutput.yaml webapi/doc/swagger/include/FreeDVDemod.yaml webapi/doc/swagger/include/FreeDVMod.yaml webapi/doc/swagger/include/FreqTracker.yaml @@ -70,6 +74,7 @@ webapi/doc/swagger/include/RemoteOutput.yaml webapi/doc/swagger/include/RigCtlServer.yaml webapi/doc/swagger/include/SDRPlay.yaml + webapi/doc/swagger/include/SDRPlayV3.yaml webapi/doc/swagger/include/SigMFFileInput.yaml webapi/doc/swagger/include/SigMFFileSink.yaml webapi/doc/swagger/include/SimplePTT.yaml diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index f210e96d8..55820cad1 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -861,6 +861,276 @@ margin-bottom: 20px; } }, "description" : "AFC settings" +}; + defs.AISDemodReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power received in channel (dB)" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "AISDemod" +}; + defs.AISDemodSettings = { + "properties" : { + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "fmDeviation" : { + "type" : "number", + "format" : "float" + }, + "correlationThreshold" : { + "type" : "number", + "format" : "float" + }, + "udpEnabled" : { + "type" : "integer", + "description" : "Whether to forward received messages to specified UDP port" + }, + "udpAddress" : { + "type" : "string", + "description" : "UDP address to forward received messages to" + }, + "udpPort" : { + "type" : "integer", + "description" : "UDP port to forward received messages to" + }, + "udpFormat" : { + "type" : "integer", + "description" : "0 for binary, 1 for NMEA" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "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" : "AISDemod" +}; + defs.AISModActions = { + "properties" : { + "tx" : { + "$ref" : "#/definitions/AISModActions_tx" + } + }, + "description" : "AISMod" +}; + defs.AISModActions_tx = { + "properties" : { + "data" : { + "type" : "string" + } + }, + "description" : "Transmit a message\n" +}; + defs.AISModReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power transmitted in channel (dB)" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "AISMod" +}; + defs.AISModSettings = { + "properties" : { + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64", + "description" : "channel center frequency shift from baseband center in Hz" + }, + "baud" : { + "type" : "integer" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float", + "description" : "channel RF bandwidth in Hz" + }, + "fmDeviation" : { + "type" : "integer", + "description" : "frequency deviation in Hz" + }, + "gain" : { + "type" : "number", + "format" : "float" + }, + "channelMute" : { + "type" : "integer" + }, + "repeat" : { + "type" : "integer" + }, + "repeatDelay" : { + "type" : "number", + "format" : "float" + }, + "repeatCount" : { + "type" : "integer" + }, + "rampUpBits" : { + "type" : "integer" + }, + "rampDownBits" : { + "type" : "integer" + }, + "rampRange" : { + "type" : "integer" + }, + "lpfTaps" : { + "type" : "integer" + }, + "rfNoise" : { + "type" : "integer", + "description" : "Boolean\n * 0 - off\n * 1 - on\n" + }, + "writeToFile" : { + "type" : "integer", + "description" : "Boolean\n * 0 - off\n * 1 - on\n" + }, + "spectrumRate" : { + "type" : "integer" + }, + "msgId" : { + "type" : "integer" + }, + "mmsi" : { + "type" : "string" + }, + "status" : { + "type" : "integer" + }, + "latitude" : { + "type" : "number", + "format" : "float" + }, + "longitude" : { + "type" : "number", + "format" : "float" + }, + "course" : { + "type" : "number", + "format" : "float" + }, + "speed" : { + "type" : "number", + "format" : "float" + }, + "heading" : { + "type" : "integer" + }, + "data" : { + "type" : "string" + }, + "bt" : { + "type" : "number", + "format" : "float" + }, + "symbolSpan" : { + "type" : "integer" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "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" + }, + "udpEnabled" : { + "type" : "integer", + "description" : "Whether to receive messages to transmit on specified UDP port" + }, + "udpAddress" : { + "type" : "string", + "description" : "UDP address to receive messages to transmit via" + }, + "udpPort" : { + "type" : "integer", + "description" : "UDP port to receive messages to transmit via" + } + }, + "description" : "AISMod" +}; + defs.AISSettings = { + "properties" : { + "title" : { + "type" : "string" + }, + "rgbColor" : { + "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" + }, + "reverseAPIChannelIndex" : { + "type" : "integer" + } + }, + "description" : "AIS settings" }; defs.AMBEDevice = { "properties" : { @@ -2532,6 +2802,9 @@ margin-bottom: 20px; "type" : "integer", "description" : "Optional for reverse API. This is the channel index from where the message comes from." }, + "AISModActions" : { + "$ref" : "#/definitions/AISModActions" + }, "APTDemodActions" : { "$ref" : "#/definitions/APTDemodActions" }, @@ -2689,6 +2962,12 @@ margin-bottom: 20px; "ADSBDemodReport" : { "$ref" : "#/definitions/ADSBDemodReport" }, + "AISDemodReport" : { + "$ref" : "#/definitions/AISDemodReport" + }, + "AISModReport" : { + "$ref" : "#/definitions/AISModReport" + }, "AMDemodReport" : { "$ref" : "#/definitions/AMDemodReport" }, @@ -2796,6 +3075,12 @@ margin-bottom: 20px; "ADSBDemodSettings" : { "$ref" : "#/definitions/ADSBDemodSettings" }, + "AISDemodSettings" : { + "$ref" : "#/definitions/AISDemodSettings" + }, + "AISModSettings" : { + "$ref" : "#/definitions/AISModSettings" + }, "AMDemodSettings" : { "$ref" : "#/definitions/AMDemodSettings" }, @@ -4110,6 +4395,9 @@ margin-bottom: 20px; "fileInputSettings" : { "$ref" : "#/definitions/FileInputSettings" }, + "fileOutputSettings" : { + "$ref" : "#/definitions/FileOutputSettings" + }, "hackRFInputSettings" : { "$ref" : "#/definitions/HackRFInputSettings" }, @@ -4539,6 +4827,9 @@ margin-bottom: 20px; "AFCSettings" : { "$ref" : "#/definitions/AFCSettings" }, + "AISSettings" : { + "$ref" : "#/definitions/AISSettings" + }, "APRSSettings" : { "$ref" : "#/definitions/APRSSettings" }, @@ -4629,6 +4920,39 @@ margin-bottom: 20px; } }, "description" : "FileInput" +}; + defs.FileOutputSettings = { + "properties" : { + "fileName" : { + "type" : "string", + "description" : "The name (path) of the file being read" + }, + "centerFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "sampleRate" : { + "type" : "integer", + "format" : "int64" + }, + "log2Interp" : { + "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" : "FileInput" }; defs.FileSinkActions = { "properties" : { @@ -7922,6 +8246,19 @@ margin-bottom: 20px; }, "tx1AntennaPath" : { "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" : "PlutoSDR" @@ -46268,7 +46605,7 @@ except ApiException as e:
- Generated 2021-04-29T21:19:02.297+02:00 + Generated 2021-05-18T01:26:07.311+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/AIS.yaml b/sdrbase/resources/webapi/doc/swagger/include/AIS.yaml new file mode 100644 index 000000000..ce29b7807 --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/AIS.yaml @@ -0,0 +1,18 @@ +AISSettings: + description: "AIS settings" + properties: + title: + type: string + rgbColor: + 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 + reverseAPIChannelIndex: + type: integer diff --git a/sdrbase/resources/webapi/doc/swagger/include/AISDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/AISDemod.yaml new file mode 100644 index 000000000..320446a62 --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/AISDemod.yaml @@ -0,0 +1,55 @@ +AISDemodSettings: + description: AISDemod + properties: + inputFrequencyOffset: + type: integer + format: int64 + rfBandwidth: + type: number + format: float + fmDeviation: + type: number + format: float + correlationThreshold: + type: number + format: float + udpEnabled: + description: "Whether to forward received messages to specified UDP port" + type: integer + udpAddress: + description: "UDP address to forward received messages to" + type: string + udpPort: + description: "UDP port to forward received messages to" + type: integer + udpFormat: + description: "0 for binary, 1 for NMEA" + type: integer + rgbColor: + type: integer + title: + type: string + streamIndex: + description: MIMO channel. Not relevant when connected to SI (single Rx). + 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 + reverseAPIChannelIndex: + type: integer + +AISDemodReport: + description: AISDemod + properties: + channelPowerDB: + description: power received in channel (dB) + type: number + format: float + channelSampleRate: + type: integer diff --git a/sdrbase/resources/webapi/doc/swagger/include/AISMod.yaml b/sdrbase/resources/webapi/doc/swagger/include/AISMod.yaml new file mode 100644 index 000000000..83d5b087a --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/AISMod.yaml @@ -0,0 +1,125 @@ +AISModSettings: + description: AISMod + properties: + inputFrequencyOffset: + description: channel center frequency shift from baseband center in Hz + type: integer + format: int64 + baud: + type: integer + rfBandwidth: + description: channel RF bandwidth in Hz + type: number + format: float + fmDeviation: + description: frequency deviation in Hz + type: integer + gain: + type: number + format: float + channelMute: + type: integer + repeat: + type: integer + repeatDelay: + type: number + format: float + repeatCount: + type: integer + rampUpBits: + type: integer + rampDownBits: + type: integer + rampRange: + type: integer + lpfTaps: + type: integer + rfNoise: + type: integer + description: > + Boolean + * 0 - off + * 1 - on + writeToFile: + type: integer + description: > + Boolean + * 0 - off + * 1 - on + spectrumRate: + type: integer + msgId: + type: integer + mmsi: + type: string + status: + type: integer + latitude: + type: number + format: float + longitude: + type: number + format: float + course: + type: number + format: float + speed: + type: number + format: float + heading: + type: integer + data: + type: string + bt: + type: number + format: float + symbolSpan: + type: integer + rgbColor: + type: integer + title: + type: string + streamIndex: + description: MIMO channel. Not relevant when connected to SI (single Rx). + 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 + reverseAPIChannelIndex: + type: integer + udpEnabled: + description: "Whether to receive messages to transmit on specified UDP port" + type: integer + udpAddress: + description: "UDP address to receive messages to transmit via" + type: string + udpPort: + description: "UDP port to receive messages to transmit via" + type: integer + +AISModReport: + description: AISMod + properties: + channelPowerDB: + description: power transmitted in channel (dB) + type: number + format: float + channelSampleRate: + type: integer + +AISModActions: + description: AISMod + properties: + tx: + type: object + properties: + data: + type: string + description: > + Transmit a message diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml index 3332bb9fb..bf5fe4fe5 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml @@ -17,6 +17,8 @@ ChannelActions: originatorChannelIndex: description: Optional for reverse API. This is the channel index from where the message comes from. type: integer + AISModActions: + $ref: "/doc/swagger/include/AISMod.yaml#/AISModActions" APTDemodActions: $ref: "/doc/swagger/include/APTDemod.yaml#/APTDemodActions" FileSinkActions: diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml index c49c7b1c1..c59374b31 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml @@ -13,6 +13,10 @@ ChannelReport: type: integer ADSBDemodReport: $ref: "/doc/swagger/include/ADSBDemod.yaml#/ADSBDemodReport" + AISDemodReport: + $ref: "/doc/swagger/include/AISDemod.yaml#/AISDemodReport" + AISModReport: + $ref: "/doc/swagger/include/AISMod.yaml#/AISModReport" AMDemodReport: $ref: "/doc/swagger/include/AMDemod.yaml#/AMDemodReport" AMModReport: diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml index b0088786e..e636cfa88 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelSettings.yaml @@ -19,6 +19,10 @@ ChannelSettings: type: integer ADSBDemodSettings: $ref: "/doc/swagger/include/ADSBDemod.yaml#/ADSBDemodSettings" + AISDemodSettings: + $ref: "/doc/swagger/include/AISDemod.yaml#/AISDemodSettings" + AISModSettings: + $ref: "/doc/swagger/include/AISMod.yaml#/AISModSettings" AMDemodSettings: $ref: "/doc/swagger/include/AMDemod.yaml#/AMDemodSettings" AMModSettings: diff --git a/sdrbase/resources/webapi/doc/swagger/include/DeviceSettings.yaml b/sdrbase/resources/webapi/doc/swagger/include/DeviceSettings.yaml index 1d8bb7198..8c29e39d5 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/DeviceSettings.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/DeviceSettings.yaml @@ -38,6 +38,8 @@ DeviceSettings: $ref: "/doc/swagger/include/FCDProPlus.yaml#/FCDProPlusSettings" fileInputSettings: $ref: "/doc/swagger/include/FileInput.yaml#/FileInputSettings" + fileOutputSettings: + $ref: "/doc/swagger/include/FileOutput.yaml#/FileOutputSettings" hackRFInputSettings: $ref: "/doc/swagger/include/HackRF.yaml#/HackRFInputSettings" hackRFOutputSettings: diff --git a/sdrbase/resources/webapi/doc/swagger/include/FeatureSettings.yaml b/sdrbase/resources/webapi/doc/swagger/include/FeatureSettings.yaml index 48c01d5f6..2ea298703 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/FeatureSettings.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/FeatureSettings.yaml @@ -15,6 +15,8 @@ FeatureSettings: type: integer AFCSettings: $ref: "/doc/swagger/include/AFC.yaml#/AFCSettings" + AISSettings: + $ref: "/doc/swagger/include/AIS.yaml#/AISSettings" APRSSettings: $ref: "/doc/swagger/include/APRS.yaml#/APRSSettings" DemodAnalyzerSettings: diff --git a/sdrbase/resources/webapi/doc/swagger/include/FileOutput.yaml b/sdrbase/resources/webapi/doc/swagger/include/FileOutput.yaml new file mode 100644 index 000000000..262026220 --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/FileOutput.yaml @@ -0,0 +1,23 @@ +FileOutputSettings: + description: FileInput + properties: + fileName: + description: The name (path) of the file being read + type: string + centerFrequency: + type: integer + format: int64 + sampleRate: + type: integer + format: int64 + log2Interp: + 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 diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index b42c85dda..fc622b828 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -4195,6 +4195,11 @@ bool WebAPIRequestMapper::getDeviceSettings( deviceSettings->setFileInputSettings(new SWGSDRangel::SWGFileInputSettings()); deviceSettings->getFileInputSettings()->fromJsonObject(settingsJsonObject); } + else if (deviceSettingsKey == "fileOutputSettings") + { + deviceSettings->setFileOutputSettings(new SWGSDRangel::SWGFileOutputSettings()); + deviceSettings->getFileOutputSettings()->fromJsonObject(settingsJsonObject); + } else if (deviceSettingsKey == "hackRFInputSettings") { deviceSettings->setHackRfInputSettings(new SWGSDRangel::SWGHackRFInputSettings()); @@ -4565,6 +4570,7 @@ void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& de deviceSettings.setFcdProPlusSettings(nullptr); deviceSettings.setFcdProSettings(nullptr); deviceSettings.setFileInputSettings(nullptr); + deviceSettings.setFileOutputSettings(nullptr); deviceSettings.setHackRfInputSettings(nullptr); deviceSettings.setHackRfOutputSettings(nullptr); deviceSettings.setLimeSdrInputSettings(nullptr); diff --git a/sdrbase/webapi/webapiutils.cpp b/sdrbase/webapi/webapiutils.cpp index d525ed001..487670022 100644 --- a/sdrbase/webapi/webapiutils.cpp +++ b/sdrbase/webapi/webapiutils.cpp @@ -229,6 +229,7 @@ const QMap WebAPIUtils::m_sinkDeviceHwIdToSettingsKey = { {"AudioOutput", "audioOutputSettings"}, {"BladeRF1", "bladeRF1OutputSettings"}, {"BladeRF2", "bladeRF2OutputSettings"}, + {"FileOutput", "fileOutputSettings"}, {"HackRF", "hackRFOutputSettings"}, {"LimeSDR", "limeSdrOutputSettings"}, {"LocalOutput", "localOutputSettings"}, diff --git a/swagger/sdrangel/api/swagger/include/DeviceSettings.yaml b/swagger/sdrangel/api/swagger/include/DeviceSettings.yaml index 1370ebc54..011a346b7 100644 --- a/swagger/sdrangel/api/swagger/include/DeviceSettings.yaml +++ b/swagger/sdrangel/api/swagger/include/DeviceSettings.yaml @@ -38,6 +38,8 @@ DeviceSettings: $ref: "http://swgserver:8081/api/swagger/include/FCDProPlus.yaml#/FCDProPlusSettings" fileInputSettings: $ref: "http://swgserver:8081/api/swagger/include/FileInput.yaml#/FileInputSettings" + fileOutputSettings: + $ref: "http://swgserver:8081/api/swagger/include/FileOutput.yaml#/FileOutputSettings" hackRFInputSettings: $ref: "http://swgserver:8081/api/swagger/include/HackRF.yaml#/HackRFInputSettings" hackRFOutputSettings: diff --git a/swagger/sdrangel/api/swagger/include/FileOutput.yaml b/swagger/sdrangel/api/swagger/include/FileOutput.yaml new file mode 100644 index 000000000..262026220 --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/FileOutput.yaml @@ -0,0 +1,23 @@ +FileOutputSettings: + description: FileInput + properties: + fileName: + description: The name (path) of the file being read + type: string + centerFrequency: + type: integer + format: int64 + sampleRate: + type: integer + format: int64 + log2Interp: + 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 diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index f210e96d8..55820cad1 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -861,6 +861,276 @@ margin-bottom: 20px; } }, "description" : "AFC settings" +}; + defs.AISDemodReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power received in channel (dB)" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "AISDemod" +}; + defs.AISDemodSettings = { + "properties" : { + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "fmDeviation" : { + "type" : "number", + "format" : "float" + }, + "correlationThreshold" : { + "type" : "number", + "format" : "float" + }, + "udpEnabled" : { + "type" : "integer", + "description" : "Whether to forward received messages to specified UDP port" + }, + "udpAddress" : { + "type" : "string", + "description" : "UDP address to forward received messages to" + }, + "udpPort" : { + "type" : "integer", + "description" : "UDP port to forward received messages to" + }, + "udpFormat" : { + "type" : "integer", + "description" : "0 for binary, 1 for NMEA" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "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" : "AISDemod" +}; + defs.AISModActions = { + "properties" : { + "tx" : { + "$ref" : "#/definitions/AISModActions_tx" + } + }, + "description" : "AISMod" +}; + defs.AISModActions_tx = { + "properties" : { + "data" : { + "type" : "string" + } + }, + "description" : "Transmit a message\n" +}; + defs.AISModReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power transmitted in channel (dB)" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "AISMod" +}; + defs.AISModSettings = { + "properties" : { + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64", + "description" : "channel center frequency shift from baseband center in Hz" + }, + "baud" : { + "type" : "integer" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float", + "description" : "channel RF bandwidth in Hz" + }, + "fmDeviation" : { + "type" : "integer", + "description" : "frequency deviation in Hz" + }, + "gain" : { + "type" : "number", + "format" : "float" + }, + "channelMute" : { + "type" : "integer" + }, + "repeat" : { + "type" : "integer" + }, + "repeatDelay" : { + "type" : "number", + "format" : "float" + }, + "repeatCount" : { + "type" : "integer" + }, + "rampUpBits" : { + "type" : "integer" + }, + "rampDownBits" : { + "type" : "integer" + }, + "rampRange" : { + "type" : "integer" + }, + "lpfTaps" : { + "type" : "integer" + }, + "rfNoise" : { + "type" : "integer", + "description" : "Boolean\n * 0 - off\n * 1 - on\n" + }, + "writeToFile" : { + "type" : "integer", + "description" : "Boolean\n * 0 - off\n * 1 - on\n" + }, + "spectrumRate" : { + "type" : "integer" + }, + "msgId" : { + "type" : "integer" + }, + "mmsi" : { + "type" : "string" + }, + "status" : { + "type" : "integer" + }, + "latitude" : { + "type" : "number", + "format" : "float" + }, + "longitude" : { + "type" : "number", + "format" : "float" + }, + "course" : { + "type" : "number", + "format" : "float" + }, + "speed" : { + "type" : "number", + "format" : "float" + }, + "heading" : { + "type" : "integer" + }, + "data" : { + "type" : "string" + }, + "bt" : { + "type" : "number", + "format" : "float" + }, + "symbolSpan" : { + "type" : "integer" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "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" + }, + "udpEnabled" : { + "type" : "integer", + "description" : "Whether to receive messages to transmit on specified UDP port" + }, + "udpAddress" : { + "type" : "string", + "description" : "UDP address to receive messages to transmit via" + }, + "udpPort" : { + "type" : "integer", + "description" : "UDP port to receive messages to transmit via" + } + }, + "description" : "AISMod" +}; + defs.AISSettings = { + "properties" : { + "title" : { + "type" : "string" + }, + "rgbColor" : { + "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" + }, + "reverseAPIChannelIndex" : { + "type" : "integer" + } + }, + "description" : "AIS settings" }; defs.AMBEDevice = { "properties" : { @@ -2532,6 +2802,9 @@ margin-bottom: 20px; "type" : "integer", "description" : "Optional for reverse API. This is the channel index from where the message comes from." }, + "AISModActions" : { + "$ref" : "#/definitions/AISModActions" + }, "APTDemodActions" : { "$ref" : "#/definitions/APTDemodActions" }, @@ -2689,6 +2962,12 @@ margin-bottom: 20px; "ADSBDemodReport" : { "$ref" : "#/definitions/ADSBDemodReport" }, + "AISDemodReport" : { + "$ref" : "#/definitions/AISDemodReport" + }, + "AISModReport" : { + "$ref" : "#/definitions/AISModReport" + }, "AMDemodReport" : { "$ref" : "#/definitions/AMDemodReport" }, @@ -2796,6 +3075,12 @@ margin-bottom: 20px; "ADSBDemodSettings" : { "$ref" : "#/definitions/ADSBDemodSettings" }, + "AISDemodSettings" : { + "$ref" : "#/definitions/AISDemodSettings" + }, + "AISModSettings" : { + "$ref" : "#/definitions/AISModSettings" + }, "AMDemodSettings" : { "$ref" : "#/definitions/AMDemodSettings" }, @@ -4110,6 +4395,9 @@ margin-bottom: 20px; "fileInputSettings" : { "$ref" : "#/definitions/FileInputSettings" }, + "fileOutputSettings" : { + "$ref" : "#/definitions/FileOutputSettings" + }, "hackRFInputSettings" : { "$ref" : "#/definitions/HackRFInputSettings" }, @@ -4539,6 +4827,9 @@ margin-bottom: 20px; "AFCSettings" : { "$ref" : "#/definitions/AFCSettings" }, + "AISSettings" : { + "$ref" : "#/definitions/AISSettings" + }, "APRSSettings" : { "$ref" : "#/definitions/APRSSettings" }, @@ -4629,6 +4920,39 @@ margin-bottom: 20px; } }, "description" : "FileInput" +}; + defs.FileOutputSettings = { + "properties" : { + "fileName" : { + "type" : "string", + "description" : "The name (path) of the file being read" + }, + "centerFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "sampleRate" : { + "type" : "integer", + "format" : "int64" + }, + "log2Interp" : { + "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" : "FileInput" }; defs.FileSinkActions = { "properties" : { @@ -7922,6 +8246,19 @@ margin-bottom: 20px; }, "tx1AntennaPath" : { "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" : "PlutoSDR" @@ -46268,7 +46605,7 @@ except ApiException as e:
- Generated 2021-04-29T21:19:02.297+02:00 + Generated 2021-05-18T01:26:07.311+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp index e188eda77..81110793e 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp @@ -58,6 +58,8 @@ SWGDeviceSettings::SWGDeviceSettings() { m_fcd_pro_plus_settings_isSet = false; file_input_settings = nullptr; m_file_input_settings_isSet = false; + file_output_settings = nullptr; + m_file_output_settings_isSet = false; hack_rf_input_settings = nullptr; m_hack_rf_input_settings_isSet = false; hack_rf_output_settings = nullptr; @@ -154,6 +156,8 @@ SWGDeviceSettings::init() { m_fcd_pro_plus_settings_isSet = false; file_input_settings = new SWGFileInputSettings(); m_file_input_settings_isSet = false; + file_output_settings = new SWGFileOutputSettings(); + m_file_output_settings_isSet = false; hack_rf_input_settings = new SWGHackRFInputSettings(); m_hack_rf_input_settings_isSet = false; hack_rf_output_settings = new SWGHackRFOutputSettings(); @@ -257,6 +261,9 @@ SWGDeviceSettings::cleanup() { if(file_input_settings != nullptr) { delete file_input_settings; } + if(file_output_settings != nullptr) { + delete file_output_settings; + } if(hack_rf_input_settings != nullptr) { delete hack_rf_input_settings; } @@ -387,6 +394,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&file_input_settings, pJson["fileInputSettings"], "SWGFileInputSettings", "SWGFileInputSettings"); + ::SWGSDRangel::setValue(&file_output_settings, pJson["fileOutputSettings"], "SWGFileOutputSettings", "SWGFileOutputSettings"); + ::SWGSDRangel::setValue(&hack_rf_input_settings, pJson["hackRFInputSettings"], "SWGHackRFInputSettings", "SWGHackRFInputSettings"); ::SWGSDRangel::setValue(&hack_rf_output_settings, pJson["hackRFOutputSettings"], "SWGHackRFOutputSettings", "SWGHackRFOutputSettings"); @@ -506,6 +515,9 @@ SWGDeviceSettings::asJsonObject() { if((file_input_settings != nullptr) && (file_input_settings->isSet())){ toJsonValue(QString("fileInputSettings"), file_input_settings, obj, QString("SWGFileInputSettings")); } + if((file_output_settings != nullptr) && (file_output_settings->isSet())){ + toJsonValue(QString("fileOutputSettings"), file_output_settings, obj, QString("SWGFileOutputSettings")); + } if((hack_rf_input_settings != nullptr) && (hack_rf_input_settings->isSet())){ toJsonValue(QString("hackRFInputSettings"), hack_rf_input_settings, obj, QString("SWGHackRFInputSettings")); } @@ -747,6 +759,16 @@ SWGDeviceSettings::setFileInputSettings(SWGFileInputSettings* file_input_setting this->m_file_input_settings_isSet = true; } +SWGFileOutputSettings* +SWGDeviceSettings::getFileOutputSettings() { + return file_output_settings; +} +void +SWGDeviceSettings::setFileOutputSettings(SWGFileOutputSettings* file_output_settings) { + this->file_output_settings = file_output_settings; + this->m_file_output_settings_isSet = true; +} + SWGHackRFInputSettings* SWGDeviceSettings::getHackRfInputSettings() { return hack_rf_input_settings; @@ -1087,6 +1109,9 @@ SWGDeviceSettings::isSet(){ if(file_input_settings && file_input_settings->isSet()){ isObjectUpdated = true; break; } + if(file_output_settings && file_output_settings->isSet()){ + isObjectUpdated = true; break; + } if(hack_rf_input_settings && hack_rf_input_settings->isSet()){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h index 26a1cd207..fb83494e1 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h @@ -34,6 +34,7 @@ #include "SWGFCDProPlusSettings.h" #include "SWGFCDProSettings.h" #include "SWGFileInputSettings.h" +#include "SWGFileOutputSettings.h" #include "SWGHackRFInputSettings.h" #include "SWGHackRFOutputSettings.h" #include "SWGKiwiSDRSettings.h" @@ -128,6 +129,9 @@ public: SWGFileInputSettings* getFileInputSettings(); void setFileInputSettings(SWGFileInputSettings* file_input_settings); + SWGFileOutputSettings* getFileOutputSettings(); + void setFileOutputSettings(SWGFileOutputSettings* file_output_settings); + SWGHackRFInputSettings* getHackRfInputSettings(); void setHackRfInputSettings(SWGHackRFInputSettings* hack_rf_input_settings); @@ -264,6 +268,9 @@ private: SWGFileInputSettings* file_input_settings; bool m_file_input_settings_isSet; + SWGFileOutputSettings* file_output_settings; + bool m_file_output_settings_isSet; + SWGHackRFInputSettings* hack_rf_input_settings; bool m_hack_rf_input_settings_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.cpp new file mode 100644 index 000000000..8f18fe139 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.cpp @@ -0,0 +1,273 @@ +/** + * 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 "SWGFileOutputSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGFileOutputSettings::SWGFileOutputSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGFileOutputSettings::SWGFileOutputSettings() { + file_name = nullptr; + m_file_name_isSet = false; + center_frequency = 0L; + m_center_frequency_isSet = false; + sample_rate = 0L; + m_sample_rate_isSet = false; + log2_interp = 0; + m_log2_interp_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; +} + +SWGFileOutputSettings::~SWGFileOutputSettings() { + this->cleanup(); +} + +void +SWGFileOutputSettings::init() { + file_name = new QString(""); + m_file_name_isSet = false; + center_frequency = 0L; + m_center_frequency_isSet = false; + sample_rate = 0L; + m_sample_rate_isSet = false; + log2_interp = 0; + m_log2_interp_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 +SWGFileOutputSettings::cleanup() { + if(file_name != nullptr) { + delete file_name; + } + + + + + if(reverse_api_address != nullptr) { + delete reverse_api_address; + } + + +} + +SWGFileOutputSettings* +SWGFileOutputSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGFileOutputSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString"); + + ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", ""); + + ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint64", ""); + + ::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "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 +SWGFileOutputSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGFileOutputSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(file_name != nullptr && *file_name != QString("")){ + toJsonValue(QString("fileName"), file_name, obj, QString("QString")); + } + if(m_center_frequency_isSet){ + obj->insert("centerFrequency", QJsonValue(center_frequency)); + } + if(m_sample_rate_isSet){ + obj->insert("sampleRate", QJsonValue(sample_rate)); + } + if(m_log2_interp_isSet){ + obj->insert("log2Interp", QJsonValue(log2_interp)); + } + 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; +} + +QString* +SWGFileOutputSettings::getFileName() { + return file_name; +} +void +SWGFileOutputSettings::setFileName(QString* file_name) { + this->file_name = file_name; + this->m_file_name_isSet = true; +} + +qint64 +SWGFileOutputSettings::getCenterFrequency() { + return center_frequency; +} +void +SWGFileOutputSettings::setCenterFrequency(qint64 center_frequency) { + this->center_frequency = center_frequency; + this->m_center_frequency_isSet = true; +} + +qint64 +SWGFileOutputSettings::getSampleRate() { + return sample_rate; +} +void +SWGFileOutputSettings::setSampleRate(qint64 sample_rate) { + this->sample_rate = sample_rate; + this->m_sample_rate_isSet = true; +} + +qint32 +SWGFileOutputSettings::getLog2Interp() { + return log2_interp; +} +void +SWGFileOutputSettings::setLog2Interp(qint32 log2_interp) { + this->log2_interp = log2_interp; + this->m_log2_interp_isSet = true; +} + +qint32 +SWGFileOutputSettings::getUseReverseApi() { + return use_reverse_api; +} +void +SWGFileOutputSettings::setUseReverseApi(qint32 use_reverse_api) { + this->use_reverse_api = use_reverse_api; + this->m_use_reverse_api_isSet = true; +} + +QString* +SWGFileOutputSettings::getReverseApiAddress() { + return reverse_api_address; +} +void +SWGFileOutputSettings::setReverseApiAddress(QString* reverse_api_address) { + this->reverse_api_address = reverse_api_address; + this->m_reverse_api_address_isSet = true; +} + +qint32 +SWGFileOutputSettings::getReverseApiPort() { + return reverse_api_port; +} +void +SWGFileOutputSettings::setReverseApiPort(qint32 reverse_api_port) { + this->reverse_api_port = reverse_api_port; + this->m_reverse_api_port_isSet = true; +} + +qint32 +SWGFileOutputSettings::getReverseApiDeviceIndex() { + return reverse_api_device_index; +} +void +SWGFileOutputSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) { + this->reverse_api_device_index = reverse_api_device_index; + this->m_reverse_api_device_index_isSet = true; +} + + +bool +SWGFileOutputSettings::isSet(){ + bool isObjectUpdated = false; + do{ + if(file_name && *file_name != QString("")){ + isObjectUpdated = true; break; + } + if(m_center_frequency_isSet){ + isObjectUpdated = true; break; + } + if(m_sample_rate_isSet){ + isObjectUpdated = true; break; + } + if(m_log2_interp_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; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.h b/swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.h new file mode 100644 index 000000000..08f200e11 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFileOutputSettings.h @@ -0,0 +1,101 @@ +/** + * 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. + */ + +/* + * SWGFileOutputSettings.h + * + * FileInput + */ + +#ifndef SWGFileOutputSettings_H_ +#define SWGFileOutputSettings_H_ + +#include + + +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGFileOutputSettings: public SWGObject { +public: + SWGFileOutputSettings(); + SWGFileOutputSettings(QString* json); + virtual ~SWGFileOutputSettings(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGFileOutputSettings* fromJson(QString &jsonString) override; + + QString* getFileName(); + void setFileName(QString* file_name); + + qint64 getCenterFrequency(); + void setCenterFrequency(qint64 center_frequency); + + qint64 getSampleRate(); + void setSampleRate(qint64 sample_rate); + + qint32 getLog2Interp(); + void setLog2Interp(qint32 log2_interp); + + 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: + QString* file_name; + bool m_file_name_isSet; + + qint64 center_frequency; + bool m_center_frequency_isSet; + + qint64 sample_rate; + bool m_sample_rate_isSet; + + qint32 log2_interp; + bool m_log2_interp_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 /* SWGFileOutputSettings_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index ce79d5135..c2be13c2c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -109,6 +109,7 @@ #include "SWGFeatureSettings.h" #include "SWGFileInputReport.h" #include "SWGFileInputSettings.h" +#include "SWGFileOutputSettings.h" #include "SWGFileSinkActions.h" #include "SWGFileSinkReport.h" #include "SWGFileSinkSettings.h" @@ -557,6 +558,9 @@ namespace SWGSDRangel { if(QString("SWGFileInputSettings").compare(type) == 0) { return new SWGFileInputSettings(); } + if(QString("SWGFileOutputSettings").compare(type) == 0) { + return new SWGFileOutputSettings(); + } if(QString("SWGFileSinkActions").compare(type) == 0) { return new SWGFileSinkActions(); }