diff --git a/plugins/samplesink/remoteoutput/remoteoutput.cpp b/plugins/samplesink/remoteoutput/remoteoutput.cpp index 3d2adffd1..45187629e 100644 --- a/plugins/samplesink/remoteoutput/remoteoutput.cpp +++ b/plugins/samplesink/remoteoutput/remoteoutput.cpp @@ -25,7 +25,7 @@ #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" #include "SWGDeviceReport.h" -#include "SWGSDRdaemonSinkReport.h" +#include "SWGRemoteOutputReport.h" #include "util/simpleserializer.h" #include "dsp/dspcommands.h" @@ -369,8 +369,8 @@ int RemoteOutput::webapiSettingsGet( QString& errorMessage) { (void) errorMessage; - response.setSdrDaemonSinkSettings(new SWGSDRangel::SWGSDRdaemonSinkSettings()); - response.getSdrDaemonSinkSettings()->init(); + response.setRemoteOutputSettings(new SWGSDRangel::SWGRemoteOutputSettings()); + response.getRemoteOutputSettings()->init(); webapiFormatDeviceSettings(response, m_settings); return 200; } @@ -385,43 +385,43 @@ int RemoteOutput::webapiSettingsPutPatch( RemoteOutputSettings settings = m_settings; if (deviceSettingsKeys.contains("sampleRate")) { - settings.m_sampleRate = response.getSdrDaemonSinkSettings()->getSampleRate(); + settings.m_sampleRate = response.getRemoteOutputSettings()->getSampleRate(); } if (deviceSettingsKeys.contains("txDelay")) { - settings.m_txDelay = response.getSdrDaemonSinkSettings()->getTxDelay(); + settings.m_txDelay = response.getRemoteOutputSettings()->getTxDelay(); } if (deviceSettingsKeys.contains("nbFECBlocks")) { - settings.m_nbFECBlocks = response.getSdrDaemonSinkSettings()->getNbFecBlocks(); + settings.m_nbFECBlocks = response.getRemoteOutputSettings()->getNbFecBlocks(); } if (deviceSettingsKeys.contains("apiAddress")) { - settings.m_apiAddress = *response.getSdrDaemonSinkSettings()->getApiAddress(); + settings.m_apiAddress = *response.getRemoteOutputSettings()->getApiAddress(); } if (deviceSettingsKeys.contains("apiPort")) { - settings.m_apiPort = response.getSdrDaemonSinkSettings()->getApiPort(); + settings.m_apiPort = response.getRemoteOutputSettings()->getApiPort(); } if (deviceSettingsKeys.contains("dataAddress")) { - settings.m_dataAddress = *response.getSdrDaemonSinkSettings()->getDataAddress(); + settings.m_dataAddress = *response.getRemoteOutputSettings()->getDataAddress(); } if (deviceSettingsKeys.contains("dataPort")) { - settings.m_dataPort = response.getSdrDaemonSinkSettings()->getDataPort(); + settings.m_dataPort = response.getRemoteOutputSettings()->getDataPort(); } if (deviceSettingsKeys.contains("deviceIndex")) { - settings.m_deviceIndex = response.getSdrDaemonSinkSettings()->getDeviceIndex(); + settings.m_deviceIndex = response.getRemoteOutputSettings()->getDeviceIndex(); } if (deviceSettingsKeys.contains("channelIndex")) { - settings.m_channelIndex = response.getSdrDaemonSinkSettings()->getChannelIndex(); + settings.m_channelIndex = response.getRemoteOutputSettings()->getChannelIndex(); } if (deviceSettingsKeys.contains("useReverseAPI")) { - settings.m_useReverseAPI = response.getSdrDaemonSinkSettings()->getUseReverseApi() != 0; + settings.m_useReverseAPI = response.getRemoteOutputSettings()->getUseReverseApi() != 0; } if (deviceSettingsKeys.contains("reverseAPIAddress")) { - settings.m_reverseAPIAddress = *response.getSdrDaemonSinkSettings()->getReverseApiAddress(); + settings.m_reverseAPIAddress = *response.getRemoteOutputSettings()->getReverseApiAddress(); } if (deviceSettingsKeys.contains("reverseAPIPort")) { - settings.m_reverseAPIPort = response.getSdrDaemonSinkSettings()->getReverseApiPort(); + settings.m_reverseAPIPort = response.getRemoteOutputSettings()->getReverseApiPort(); } if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) { - settings.m_reverseAPIDeviceIndex = response.getSdrDaemonSinkSettings()->getReverseApiDeviceIndex(); + settings.m_reverseAPIDeviceIndex = response.getRemoteOutputSettings()->getReverseApiDeviceIndex(); } MsgConfigureRemoteOutput *msg = MsgConfigureRemoteOutput::create(settings, force); @@ -442,41 +442,41 @@ int RemoteOutput::webapiReportGet( QString& errorMessage) { (void) errorMessage; - response.setSdrDaemonSinkReport(new SWGSDRangel::SWGSDRdaemonSinkReport()); - response.getSdrDaemonSinkReport()->init(); + response.setRemoteOutputReport(new SWGSDRangel::SWGRemoteOutputReport()); + response.getRemoteOutputReport()->init(); webapiFormatDeviceReport(response); return 200; } void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteOutputSettings& settings) { - response.getSdrDaemonSinkSettings()->setCenterFrequency(m_centerFrequency); - response.getSdrDaemonSinkSettings()->setSampleRate(settings.m_sampleRate); - response.getSdrDaemonSinkSettings()->setTxDelay(settings.m_txDelay); - response.getSdrDaemonSinkSettings()->setNbFecBlocks(settings.m_nbFECBlocks); - response.getSdrDaemonSinkSettings()->setApiAddress(new QString(settings.m_apiAddress)); - response.getSdrDaemonSinkSettings()->setApiPort(settings.m_apiPort); - response.getSdrDaemonSinkSettings()->setDataAddress(new QString(settings.m_dataAddress)); - response.getSdrDaemonSinkSettings()->setDataPort(settings.m_dataPort); - response.getSdrDaemonSinkSettings()->setDeviceIndex(settings.m_deviceIndex); - response.getSdrDaemonSinkSettings()->setChannelIndex(settings.m_channelIndex); - response.getSdrDaemonSinkSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); + response.getRemoteOutputSettings()->setCenterFrequency(m_centerFrequency); + response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate); + response.getRemoteOutputSettings()->setTxDelay(settings.m_txDelay); + response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks); + response.getRemoteOutputSettings()->setApiAddress(new QString(settings.m_apiAddress)); + response.getRemoteOutputSettings()->setApiPort(settings.m_apiPort); + response.getRemoteOutputSettings()->setDataAddress(new QString(settings.m_dataAddress)); + response.getRemoteOutputSettings()->setDataPort(settings.m_dataPort); + response.getRemoteOutputSettings()->setDeviceIndex(settings.m_deviceIndex); + response.getRemoteOutputSettings()->setChannelIndex(settings.m_channelIndex); + response.getRemoteOutputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); - if (response.getSdrDaemonSinkSettings()->getReverseApiAddress()) { - *response.getSdrDaemonSinkSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress; + if (response.getRemoteOutputSettings()->getReverseApiAddress()) { + *response.getRemoteOutputSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress; } else { - response.getSdrDaemonSinkSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress)); + response.getRemoteOutputSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress)); } - response.getSdrDaemonSinkSettings()->setReverseApiPort(settings.m_reverseAPIPort); - response.getSdrDaemonSinkSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); + response.getRemoteOutputSettings()->setReverseApiPort(settings.m_reverseAPIPort); + response.getRemoteOutputSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); } void RemoteOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response) { uint64_t ts_usecs; - response.getSdrDaemonSinkReport()->setBufferRwBalance(m_sampleSourceFifo.getRWBalance()); - response.getSdrDaemonSinkReport()->setSampleCount(m_remoteOutputThread ? (int) m_remoteOutputThread->getSamplesCount(ts_usecs) : 0); + response.getRemoteOutputReport()->setBufferRwBalance(m_sampleSourceFifo.getRWBalance()); + response.getRemoteOutputReport()->setSampleCount(m_remoteOutputThread ? (int) m_remoteOutputThread->getSamplesCount(ts_usecs) : 0); } void RemoteOutput::tick() @@ -533,9 +533,9 @@ void RemoteOutput::networkManagerFinished(QNetworkReply *reply) void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString& answer) { - if (jsonObject.contains("DaemonSourceReport")) + if (jsonObject.contains("RemoteSourceReport")) { - QJsonObject report = jsonObject["DaemonSourceReport"].toObject(); + QJsonObject report = jsonObject["RemoteSourceReport"].toObject(); m_centerFrequency = report["deviceCenterFreq"].toInt() * 1000; if (!m_remoteOutputThread) { @@ -601,7 +601,7 @@ void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString& m_lastSampleCount = sampleCount; m_lastQueueLength = queueLength; } - else if (jsonObject.contains("sdrDaemonSinkSettings")) + else if (jsonObject.contains("remoteOutputSettings")) { qDebug("RemoteOutput::analyzeApiReply: reply:\n%s", answer.toStdString().c_str()); } @@ -623,38 +623,38 @@ void RemoteOutput::webapiReverseSendSettings(QList& deviceSettingsKeys, { SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); swgDeviceSettings->setTx(1); - swgDeviceSettings->setDeviceHwType(new QString("SDRdaemonSink")); - swgDeviceSettings->setSdrDaemonSinkSettings(new SWGSDRangel::SWGSDRdaemonSinkSettings()); - SWGSDRangel::SWGSDRdaemonSinkSettings *swgSdrDaemonSinkSettings = swgDeviceSettings->getSdrDaemonSinkSettings(); + swgDeviceSettings->setDeviceHwType(new QString("RemoteOutput")); + swgDeviceSettings->setRemoteOutputSettings(new SWGSDRangel::SWGRemoteOutputSettings()); + SWGSDRangel::SWGRemoteOutputSettings *swgRemoteOutputSettings = swgDeviceSettings->getRemoteOutputSettings(); // transfer data that has been modified. When force is on transfer all data except reverse API data if (deviceSettingsKeys.contains("sampleRate") || force) { - swgSdrDaemonSinkSettings->setSampleRate(settings.m_sampleRate); + swgRemoteOutputSettings->setSampleRate(settings.m_sampleRate); } if (deviceSettingsKeys.contains("txDelay") || force) { - swgSdrDaemonSinkSettings->setTxDelay(settings.m_txDelay); + swgRemoteOutputSettings->setTxDelay(settings.m_txDelay); } if (deviceSettingsKeys.contains("nbFECBlocks") || force) { - swgSdrDaemonSinkSettings->setNbFecBlocks(settings.m_nbFECBlocks); + swgRemoteOutputSettings->setNbFecBlocks(settings.m_nbFECBlocks); } if (deviceSettingsKeys.contains("apiAddress") || force) { - swgSdrDaemonSinkSettings->setApiAddress(new QString(settings.m_apiAddress)); + swgRemoteOutputSettings->setApiAddress(new QString(settings.m_apiAddress)); } if (deviceSettingsKeys.contains("apiPort") || force) { - swgSdrDaemonSinkSettings->setApiPort(settings.m_apiPort); + swgRemoteOutputSettings->setApiPort(settings.m_apiPort); } if (deviceSettingsKeys.contains("dataAddress") || force) { - swgSdrDaemonSinkSettings->setDataAddress(new QString(settings.m_dataAddress)); + swgRemoteOutputSettings->setDataAddress(new QString(settings.m_dataAddress)); } if (deviceSettingsKeys.contains("dataPort") || force) { - swgSdrDaemonSinkSettings->setDataPort(settings.m_dataPort); + swgRemoteOutputSettings->setDataPort(settings.m_dataPort); } if (deviceSettingsKeys.contains("deviceIndex") || force) { - swgSdrDaemonSinkSettings->setDeviceIndex(settings.m_deviceIndex); + swgRemoteOutputSettings->setDeviceIndex(settings.m_deviceIndex); } if (deviceSettingsKeys.contains("channelIndex") || force) { - swgSdrDaemonSinkSettings->setChannelIndex(settings.m_channelIndex); + swgRemoteOutputSettings->setChannelIndex(settings.m_channelIndex); } QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings") diff --git a/plugins/samplesink/remoteoutput/remoteoutputgui.cpp b/plugins/samplesink/remoteoutput/remoteoutputgui.cpp index e2965e310..631099e98 100644 --- a/plugins/samplesink/remoteoutput/remoteoutputgui.cpp +++ b/plugins/samplesink/remoteoutput/remoteoutputgui.cpp @@ -550,9 +550,9 @@ void RemoteOutputSinkGui::analyzeApiReply(const QJsonObject& jsonObject) { QString infoLine; - if (jsonObject.contains("DaemonSourceReport")) + if (jsonObject.contains("RemoteSourceReport")) { - QJsonObject report = jsonObject["DaemonSourceReport"].toObject(); + QJsonObject report = jsonObject["RemoteSourceReport"].toObject(); m_deviceCenterFrequency = report["deviceCenterFreq"].toInt() * 1000; m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); ui->centerFrequency->setValue(m_deviceCenterFrequency/1000); diff --git a/sdrbase/resources/res.qrc b/sdrbase/resources/res.qrc index 80d3c1b8f..e00ae4d9b 100644 --- a/sdrbase/resources/res.qrc +++ b/sdrbase/resources/res.qrc @@ -25,7 +25,7 @@ webapi/doc/swagger/include/RemoteSink.yaml webapi/doc/swagger/include/RemoteSource.yaml webapi/doc/swagger/include/SDRDaemonSource.yaml - webapi/doc/swagger/include/SDRDaemonSink.yaml + webapi/doc/swagger/include/RemoteOutput.yaml webapi/doc/swagger/include/SDRPlay.yaml webapi/doc/swagger/include/SoapySDR.yaml webapi/doc/swagger/include/SSBDemod.yaml diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index d94dd8bc9..dedca2a08 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -2134,8 +2134,8 @@ margin-bottom: 20px; "rtlSdrReport" : { "$ref" : "#/definitions/RtlSdrReport" }, - "sdrDaemonSinkReport" : { - "$ref" : "#/definitions/SDRdaemonSinkReport" + "remoteOutputReport" : { + "$ref" : "#/definitions/RemoteOutputReport" }, "sdrDaemonSourceReport" : { "$ref" : "#/definitions/SDRdaemonSourceReport" @@ -2261,8 +2261,8 @@ margin-bottom: 20px; "rtlSdrSettings" : { "$ref" : "#/definitions/RtlSdrSettings" }, - "sdrDaemonSinkSettings" : { - "$ref" : "#/definitions/SDRdaemonSinkSettings" + "remoteOutputSettings" : { + "$ref" : "#/definitions/RemoteOutputSettings" }, "sdrDaemonSourceSettings" : { "$ref" : "#/definitions/SDRdaemonSourceSettings" @@ -3709,6 +3709,71 @@ margin-bottom: 20px; } }, "description" : "An arbitrary range of floating point values" +}; + defs.RemoteOutputReport = { + "properties" : { + "bufferRWBalance" : { + "type" : "number", + "format" : "float", + "description" : "ratio off the mid buffer (positive read leads)" + }, + "sampleCount" : { + "type" : "integer", + "description" : "count of samples that have been sent" + } + }, + "description" : "RemoteOutput" +}; + defs.RemoteOutputSettings = { + "properties" : { + "centerFrequency" : { + "type" : "integer", + "format" : "uint64" + }, + "sampleRate" : { + "type" : "integer" + }, + "txDelay" : { + "type" : "number", + "format" : "float", + "description" : "minimum delay in ms between two consecutive packets sending" + }, + "nbFECBlocks" : { + "type" : "integer" + }, + "apiAddress" : { + "type" : "string" + }, + "apiPort" : { + "type" : "integer" + }, + "dataAddress" : { + "type" : "string" + }, + "dataPort" : { + "type" : "integer" + }, + "deviceIndex" : { + "type" : "integer" + }, + "channelIndex" : { + "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" : "RemoteOutput" }; defs.RemoteSinkSettings = { "properties" : { @@ -4020,71 +4085,6 @@ margin-bottom: 20px; } }, "description" : "SDRplay1" -}; - defs.SDRdaemonSinkReport = { - "properties" : { - "bufferRWBalance" : { - "type" : "number", - "format" : "float", - "description" : "ratio off the mid buffer (positive read leads)" - }, - "sampleCount" : { - "type" : "integer", - "description" : "count of samples that have been sent" - } - }, - "description" : "SDRdaemonSource" -}; - defs.SDRdaemonSinkSettings = { - "properties" : { - "centerFrequency" : { - "type" : "integer", - "format" : "uint64" - }, - "sampleRate" : { - "type" : "integer" - }, - "txDelay" : { - "type" : "number", - "format" : "float", - "description" : "minimum delay in ms between two consecutive packets sending" - }, - "nbFECBlocks" : { - "type" : "integer" - }, - "apiAddress" : { - "type" : "string" - }, - "apiPort" : { - "type" : "integer" - }, - "dataAddress" : { - "type" : "string" - }, - "dataPort" : { - "type" : "integer" - }, - "deviceIndex" : { - "type" : "integer" - }, - "channelIndex" : { - "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" : "SDRdaemonSink" }; defs.SDRdaemonSourceReport = { "properties" : { @@ -5505,7 +5505,7 @@ margin-bottom: 20px;