diff --git a/plugins/channelrx/daemonsink/daemonsinkgui.h b/plugins/channelrx/daemonsink/daemonsinkgui.h index 139f3281c..477d6991b 100644 --- a/plugins/channelrx/daemonsink/daemonsinkgui.h +++ b/plugins/channelrx/daemonsink/daemonsinkgui.h @@ -17,6 +17,8 @@ #ifndef PLUGINS_CHANNELRX_DAEMONSINK_DAEMONSINKGUI_H_ #define PLUGINS_CHANNELRX_DAEMONSINK_DAEMONSINKGUI_H_ +#include + #include #include diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index 1ac07377e..3f79ff6a8 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -15,12 +15,16 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#include -#include #include "boost/format.hpp" #include #include +#include +#include +#include +#include +#include + #include "SWGChannelSettings.h" #include "SWGBFMDemodSettings.h" #include "SWGChannelReport.h" @@ -100,10 +104,16 @@ BFMDemod::BFMDemod(DeviceSourceAPI *deviceAPI) : m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this); m_deviceAPI->addThreadedSink(m_threadedChannelizer); m_deviceAPI->addChannelAPI(this); + + m_networkManager = new QNetworkAccessManager(); + connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); } BFMDemod::~BFMDemod() { + disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); + delete m_networkManager; + DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_audioFifo); m_deviceAPI->removeChannelAPI(this); @@ -449,15 +459,38 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force) << " m_showPilot: " << settings.m_showPilot << " m_rdsActive: " << settings.m_rdsActive << " m_audioDeviceName: " << settings.m_audioDeviceName + << " m_useReverseAPI: " << settings.m_useReverseAPI << " force: " << force; + QList reverseAPIKeys; + + if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) { + reverseAPIKeys.append("inputFrequencyOffset"); + } + if ((settings.m_volume != m_settings.m_volume) || force) { + reverseAPIKeys.append("volume"); + } + if ((settings.m_audioStereo != m_settings.m_audioStereo) || force) { + reverseAPIKeys.append("audioStereo"); + } + if ((settings.m_lsbStereo != m_settings.m_lsbStereo) || force) { + reverseAPIKeys.append("lsbStereo"); + } + if ((settings.m_showPilot != m_settings.m_showPilot) || force) { + reverseAPIKeys.append("showPilot"); + } + if ((settings.m_rdsActive != m_settings.m_rdsActive) || force) { + reverseAPIKeys.append("rdsActive"); + } + if ((settings.m_audioStereo && (settings.m_audioStereo != m_settings.m_audioStereo)) || force) { m_pilotPLL.configure(19000.0/m_inputSampleRate, 50.0/m_inputSampleRate, 0.01); } - if((settings.m_afBandwidth != m_settings.m_afBandwidth) || force) + if ((settings.m_afBandwidth != m_settings.m_afBandwidth) || force) { + reverseAPIKeys.append("afBandwidth"); m_settingsMutex.lock(); m_interpolator.create(16, m_inputSampleRate, settings.m_afBandwidth); @@ -472,11 +505,14 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force) m_interpolatorRDSDistanceRemain = (Real) m_inputSampleRate / 250000.0; m_interpolatorRDSDistance = (Real) m_inputSampleRate / 250000.0; + m_lowpass.create(21, m_audioSampleRate, settings.m_afBandwidth); + m_settingsMutex.unlock(); } - if((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) + if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) { + reverseAPIKeys.append("rfBandwidth"); m_settingsMutex.lock(); Real lowCut = -(settings.m_rfBandwidth / 2.0) / m_inputSampleRate; Real hiCut = (settings.m_rfBandwidth / 2.0) / m_inputSampleRate; @@ -485,22 +521,15 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force) m_settingsMutex.unlock(); } - if ((settings.m_afBandwidth != m_settings.m_afBandwidth) || force) - { - m_settingsMutex.lock(); - qDebug() << "BFMDemod::handleMessage: m_lowpass.create"; - m_lowpass.create(21, m_audioSampleRate, settings.m_afBandwidth); - m_settingsMutex.unlock(); - } - if ((settings.m_squelch != m_settings.m_squelch) || force) { - qDebug() << "BFMDemod::handleMessage: set m_squelchLevel"; + reverseAPIKeys.append("squelch"); m_squelchLevel = std::pow(10.0, settings.m_squelch / 10.0); } if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force) { + reverseAPIKeys.append("audioDeviceName"); AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); int audioDeviceIndex = audioDeviceManager->getOutputDeviceIndex(settings.m_audioDeviceName); //qDebug("AMDemod::applySettings: audioDeviceName: %s audioDeviceIndex: %d", qPrintable(settings.m_audioDeviceName), audioDeviceIndex); @@ -512,6 +541,16 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force) } } + 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) || + (m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex); + webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force); + } + m_settings = settings; } @@ -596,6 +635,21 @@ int BFMDemod::webapiSettingsPutPatch( if (channelSettingsKeys.contains("audioDeviceName")) { settings.m_audioDeviceName = *response.getBfmDemodSettings()->getAudioDeviceName(); } + if (channelSettingsKeys.contains("useReverseAPI")) { + settings.m_useReverseAPI = response.getBfmDemodSettings()->getUseReverseApi() != 0; + } + if (channelSettingsKeys.contains("reverseAPIAddress")) { + settings.m_reverseAPIAddress = *response.getBfmDemodSettings()->getReverseApiAddress() != 0; + } + if (channelSettingsKeys.contains("reverseAPIPort")) { + settings.m_reverseAPIPort = response.getBfmDemodSettings()->getReverseApiPort(); + } + if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) { + settings.m_reverseAPIDeviceIndex = response.getBfmDemodSettings()->getReverseApiDeviceIndex(); + } + if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { + settings.m_reverseAPIChannelIndex = response.getBfmDemodSettings()->getReverseApiChannelIndex(); + } if (frequencyOffsetChanged) { @@ -654,6 +708,18 @@ void BFMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp } else { response.getBfmDemodSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName)); } + + response.getBfmDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); + + if (response.getBfmDemodSettings()->getReverseApiAddress()) { + *response.getBfmDemodSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress; + } else { + response.getBfmDemodSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress)); + } + + response.getBfmDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort); + response.getBfmDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); + response.getBfmDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); } void BFMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) @@ -707,3 +773,87 @@ void BFMDemod::webapiFormatRDSReport(SWGSDRangel::SWGRDSReport *report) } } } + +void BFMDemod::webapiReverseSendSettings(QList& channelSettingsKeys, const BFMDemodSettings& settings, bool force) +{ + SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); + swgChannelSettings->setTx(0); + swgChannelSettings->setChannelType(new QString("BFMDemod")); + swgChannelSettings->setBfmDemodSettings(new SWGSDRangel::SWGBFMDemodSettings()); + SWGSDRangel::SWGBFMDemodSettings *swgBFMDemodSettings = swgChannelSettings->getBfmDemodSettings(); + + // transfer data that has been modified. When force is on transfer all data except reverse API data + + if (channelSettingsKeys.contains("inputFrequencyOffset") || force) { + swgBFMDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset); + } + if (channelSettingsKeys.contains("rfBandwidth") || force) { + swgBFMDemodSettings->setRfBandwidth(settings.m_rfBandwidth); + } + if (channelSettingsKeys.contains("afBandwidth") || force) { + swgBFMDemodSettings->setAfBandwidth(settings.m_afBandwidth); + } + if (channelSettingsKeys.contains("volume") || force) { + swgBFMDemodSettings->setVolume(settings.m_volume); + } + if (channelSettingsKeys.contains("squelch") || force) { + swgBFMDemodSettings->setSquelch(settings.m_squelch); + } + if (channelSettingsKeys.contains("audioStereo") || force) { + swgBFMDemodSettings->setAudioStereo(settings.m_audioStereo ? 1 : 0); + } + if (channelSettingsKeys.contains("lsbStereo") || force) { + swgBFMDemodSettings->setLsbStereo(settings.m_lsbStereo ? 1 : 0); + } + if (channelSettingsKeys.contains("showPilot") || force) { + swgBFMDemodSettings->setShowPilot(settings.m_showPilot ? 1 : 0); + } + if (channelSettingsKeys.contains("rdsActive") || force) { + swgBFMDemodSettings->setRdsActive(settings.m_rdsActive ? 1 : 0); + } + if (channelSettingsKeys.contains("rgbColor") || force) { + swgBFMDemodSettings->setRgbColor(settings.m_rgbColor); + } + if (channelSettingsKeys.contains("title") || force) { + swgBFMDemodSettings->setTitle(new QString(settings.m_title)); + } + if (channelSettingsKeys.contains("audioDeviceName") || force) { + swgBFMDemodSettings->setAudioDeviceName(new QString(settings.m_audioDeviceName)); + } + + QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") + .arg(settings.m_reverseAPIAddress) + .arg(settings.m_reverseAPIPort) + .arg(settings.m_reverseAPIDeviceIndex) + .arg(settings.m_reverseAPIChannelIndex); + m_networkRequest.setUrl(QUrl(channelSettingsURL)); + m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + QBuffer *buffer=new QBuffer(); + buffer->open((QBuffer::ReadWrite)); + buffer->write(swgChannelSettings->asJson().toUtf8()); + buffer->seek(0); + + // Always use PATCH to avoid passing reverse API settings + m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer); + + delete swgChannelSettings; +} + +void BFMDemod::networkManagerFinished(QNetworkReply *reply) +{ + QNetworkReply::NetworkError replyError = reply->error(); + + if (replyError) + { + qWarning() << "BFMDemod::networkManagerFinished:" + << " error(" << (int) replyError + << "): " << replyError + << ": " << reply->errorString(); + return; + } + + QString answer = reply->readAll(); + answer.chop(1); // remove last \n + qDebug("BFMDemod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str()); +} diff --git a/plugins/channelrx/demodbfm/bfmdemod.h b/plugins/channelrx/demodbfm/bfmdemod.h index 700deb6cf..61868beed 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.h +++ b/plugins/channelrx/demodbfm/bfmdemod.h @@ -18,9 +18,11 @@ #ifndef INCLUDE_BFMDEMOD_H #define INCLUDE_BFMDEMOD_H -#include #include +#include +#include + #include "dsp/basebandsamplesink.h" #include "channel/channelsinkapi.h" #include "dsp/nco.h" @@ -39,6 +41,8 @@ #include "rdsdemod.h" #include "bfmdemodsettings.h" +class QNetworkAccessManager; +class QNetworkReply; class DeviceSourceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; @@ -48,6 +52,7 @@ namespace SWGSDRangel { } class BFMDemod : public BasebandSampleSink, public ChannelSinkAPI { + Q_OBJECT public: class MsgConfigureBFMDemod : public Message { MESSAGE_CLASS_DECLARATION @@ -117,7 +122,7 @@ public: BFMDemod(DeviceSourceAPI *deviceAPI); virtual ~BFMDemod(); - virtual void destroy() { delete this; } + virtual void destroy() { delete this; } void setSampleSink(BasebandSampleSink* sampleSink) { m_sampleSink = sampleSink; } int getSampleRate() const { return m_inputSampleRate; } @@ -269,6 +274,9 @@ private: static const int m_udpBlockSize; + QNetworkAccessManager *m_networkManager; + QNetworkRequest m_networkRequest; + void applyAudioSampleRate(int sampleRate); void applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force = false); void applySettings(const BFMDemodSettings& settings, bool force = false); @@ -276,6 +284,10 @@ private: void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const BFMDemodSettings& settings); void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response); void webapiFormatRDSReport(SWGSDRangel::SWGRDSReport *report); + void webapiReverseSendSettings(QList& channelSettingsKeys, const BFMDemodSettings& settings, bool force); + +private slots: + void networkManagerFinished(QNetworkReply *reply); }; #endif // INCLUDE_BFMDEMOD_H diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.cpp b/plugins/channelrx/demodbfm/bfmdemodgui.cpp index 6b22b5a41..0e8aa2012 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.cpp +++ b/plugins/channelrx/demodbfm/bfmdemodgui.cpp @@ -319,12 +319,23 @@ void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) void BFMDemodGUI::onMenuDialogCalled(const QPoint &p) { BasicChannelSettingsDialog dialog(&m_channelMarker, 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.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex); + dialog.move(p); dialog.exec(); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); + m_settings.m_useReverseAPI = dialog.useReverseAPI(); + m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); + m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); + m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); + m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex(); setWindowTitle(m_settings.m_title); setTitleColor(m_settings.m_rgbColor); diff --git a/plugins/channelrx/demodbfm/bfmdemodsettings.cpp b/plugins/channelrx/demodbfm/bfmdemodsettings.cpp index 9bb54d736..96fa37cb0 100644 --- a/plugins/channelrx/demodbfm/bfmdemodsettings.cpp +++ b/plugins/channelrx/demodbfm/bfmdemodsettings.cpp @@ -48,6 +48,11 @@ void BFMDemodSettings::resetToDefaults() m_rgbColor = QColor(80, 120, 228).rgb(); m_title = "Broadcast FM Demod"; m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; + m_useReverseAPI = false; + m_reverseAPIAddress = "127.0.0.1"; + m_reverseAPIPort = 8888; + m_reverseAPIDeviceIndex = 0; + m_reverseAPIChannelIndex = 0; } QByteArray BFMDemodSettings::serialize() const @@ -73,6 +78,11 @@ QByteArray BFMDemodSettings::serialize() const s.writeString(12, m_title); s.writeString(13, m_audioDeviceName); + s.writeBool(14, m_useReverseAPI); + s.writeString(15, m_reverseAPIAddress); + s.writeU32(16, m_reverseAPIPort); + s.writeU32(17, m_reverseAPIDeviceIndex); + s.writeU32(18, m_reverseAPIChannelIndex); return s.final(); } @@ -91,6 +101,7 @@ bool BFMDemodSettings::deserialize(const QByteArray& data) { QByteArray bytetmp; qint32 tmp; + uint32_t utmp; QString strtmp; d.readS32(1, &tmp, 0); @@ -122,6 +133,20 @@ bool BFMDemodSettings::deserialize(const QByteArray& data) d.readString(12, &m_title, "Broadcast FM Demod"); d.readString(13, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName); + d.readBool(14, &m_useReverseAPI, false); + d.readString(15, &m_reverseAPIAddress, "127.0.0.1"); + d.readU32(16, &utmp, 0); + + if ((utmp > 1023) && (utmp < 65535)) { + m_reverseAPIPort = utmp; + } else { + m_reverseAPIPort = 8888; + } + + d.readU32(17, &utmp, 0); + m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; + d.readU32(18, &utmp, 0); + m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; return true; } diff --git a/plugins/channelrx/demodbfm/bfmdemodsettings.h b/plugins/channelrx/demodbfm/bfmdemodsettings.h index 5400baff3..3dbbc6f44 100644 --- a/plugins/channelrx/demodbfm/bfmdemodsettings.h +++ b/plugins/channelrx/demodbfm/bfmdemodsettings.h @@ -35,6 +35,11 @@ struct BFMDemodSettings quint32 m_rgbColor; QString m_title; QString m_audioDeviceName; + bool m_useReverseAPI; + QString m_reverseAPIAddress; + uint16_t m_reverseAPIPort; + uint16_t m_reverseAPIDeviceIndex; + uint16_t m_reverseAPIChannelIndex; Serializable *m_channelMarker; Serializable *m_spectrumGUI; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 398c9614a..5143067cc 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -1309,6 +1309,22 @@ margin-bottom: 20px; }, "audioDeviceName" : { "type" : "string" + }, + "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" : "BFMDemod" @@ -23845,7 +23861,7 @@ except ApiException as e:
- Generated 2018-12-21T17:28:44.403+01:00 + Generated 2018-12-22T06:36:02.816+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml index 65b979633..6b1fb54fc 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/BFMDemod.yaml @@ -30,6 +30,17 @@ BFMDemodSettings: type: string audioDeviceName: type: string + 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 BFMDemodReport: description: BFMDemod @@ -54,7 +65,7 @@ BFMDemodReport: format: float rdsReport: $ref: "#/RDSReport" - + RDSReport: description: RDS information properties: diff --git a/sdrgui/device/deviceuiset.h b/sdrgui/device/deviceuiset.h index 0bb8d32dc..cd44a9262 100644 --- a/sdrgui/device/deviceuiset.h +++ b/sdrgui/device/deviceuiset.h @@ -78,7 +78,7 @@ private: ChannelInstanceRegistration() : m_channelName(), - m_gui(NULL) + m_gui(nullptr) { } ChannelInstanceRegistration(const QString& channelName, PluginInstanceGUI* pluginGUI) : diff --git a/swagger/sdrangel/api/swagger/include/BFMDemod.yaml b/swagger/sdrangel/api/swagger/include/BFMDemod.yaml index 65b979633..6b1fb54fc 100644 --- a/swagger/sdrangel/api/swagger/include/BFMDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/BFMDemod.yaml @@ -30,6 +30,17 @@ BFMDemodSettings: type: string audioDeviceName: type: string + 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 BFMDemodReport: description: BFMDemod @@ -54,7 +65,7 @@ BFMDemodReport: format: float rdsReport: $ref: "#/RDSReport" - + RDSReport: description: RDS information properties: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 398c9614a..5143067cc 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -1309,6 +1309,22 @@ margin-bottom: 20px; }, "audioDeviceName" : { "type" : "string" + }, + "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" : "BFMDemod" @@ -23845,7 +23861,7 @@ except ApiException as e:
- Generated 2018-12-21T17:28:44.403+01:00 + Generated 2018-12-22T06:36:02.816+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp index 07285f789..42edd857a 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.cpp @@ -52,6 +52,16 @@ SWGBFMDemodSettings::SWGBFMDemodSettings() { m_title_isSet = false; audio_device_name = nullptr; m_audio_device_name_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; + reverse_api_channel_index = 0; + m_reverse_api_channel_index_isSet = false; } SWGBFMDemodSettings::~SWGBFMDemodSettings() { @@ -84,6 +94,16 @@ SWGBFMDemodSettings::init() { m_title_isSet = false; audio_device_name = new QString(""); m_audio_device_name_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; + reverse_api_channel_index = 0; + m_reverse_api_channel_index_isSet = false; } void @@ -104,6 +124,13 @@ SWGBFMDemodSettings::cleanup() { if(audio_device_name != nullptr) { delete audio_device_name; } + + if(reverse_api_address != nullptr) { + delete reverse_api_address; + } + + + } SWGBFMDemodSettings* @@ -141,6 +168,16 @@ SWGBFMDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString"); + ::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", ""); + + ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", ""); + } QString @@ -193,6 +230,21 @@ SWGBFMDemodSettings::asJsonObject() { if(audio_device_name != nullptr && *audio_device_name != QString("")){ toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString")); } + 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)); + } + if(m_reverse_api_channel_index_isSet){ + obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index)); + } return obj; } @@ -317,6 +369,56 @@ SWGBFMDemodSettings::setAudioDeviceName(QString* audio_device_name) { this->m_audio_device_name_isSet = true; } +qint32 +SWGBFMDemodSettings::getUseReverseApi() { + return use_reverse_api; +} +void +SWGBFMDemodSettings::setUseReverseApi(qint32 use_reverse_api) { + this->use_reverse_api = use_reverse_api; + this->m_use_reverse_api_isSet = true; +} + +QString* +SWGBFMDemodSettings::getReverseApiAddress() { + return reverse_api_address; +} +void +SWGBFMDemodSettings::setReverseApiAddress(QString* reverse_api_address) { + this->reverse_api_address = reverse_api_address; + this->m_reverse_api_address_isSet = true; +} + +qint32 +SWGBFMDemodSettings::getReverseApiPort() { + return reverse_api_port; +} +void +SWGBFMDemodSettings::setReverseApiPort(qint32 reverse_api_port) { + this->reverse_api_port = reverse_api_port; + this->m_reverse_api_port_isSet = true; +} + +qint32 +SWGBFMDemodSettings::getReverseApiDeviceIndex() { + return reverse_api_device_index; +} +void +SWGBFMDemodSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) { + this->reverse_api_device_index = reverse_api_device_index; + this->m_reverse_api_device_index_isSet = true; +} + +qint32 +SWGBFMDemodSettings::getReverseApiChannelIndex() { + return reverse_api_channel_index; +} +void +SWGBFMDemodSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) { + this->reverse_api_channel_index = reverse_api_channel_index; + this->m_reverse_api_channel_index_isSet = true; +} + bool SWGBFMDemodSettings::isSet(){ @@ -334,6 +436,11 @@ SWGBFMDemodSettings::isSet(){ if(m_rgb_color_isSet){ isObjectUpdated = true; break;} if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;} if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;} + if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;} + if(reverse_api_address != nullptr && *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;} + if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h index da74f3352..4b15eb0ec 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGBFMDemodSettings.h @@ -78,6 +78,21 @@ public: QString* getAudioDeviceName(); void setAudioDeviceName(QString* audio_device_name); + 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); + + qint32 getReverseApiChannelIndex(); + void setReverseApiChannelIndex(qint32 reverse_api_channel_index); + virtual bool isSet() override; @@ -118,6 +133,21 @@ private: QString* audio_device_name; bool m_audio_device_name_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; + + qint32 reverse_api_channel_index; + bool m_reverse_api_channel_index_isSet; + }; }