1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Remote Source: use fixed sample rate set to baseband sample rate. Remote Output: use sample rate from remote

This commit is contained in:
f4exb 2021-12-12 19:54:57 +01:00
parent 56ba6f3d80
commit 1168eefcc9
17 changed files with 120 additions and 212 deletions

View File

@ -54,36 +54,6 @@ void RemoteSourceSource::pull(SampleVector::iterator begin, unsigned int nbSampl
void RemoteSourceSource::pullOne(Sample& sample)
{
m_dataReadQueue.readSample(sample, true); // true is scale for Tx
return;
Complex ci;
if (m_interpolatorDistance > 1.0f) // decimate
{
getSample();
while (!m_interpolator.decimate(&m_interpolatorDistanceRemain, m_modSample, &ci)) {
getSample();
}
}
else
{
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ci)) {
getSample();
}
}
m_interpolatorDistanceRemain += m_interpolatorDistance;
sample.m_real = (FixReal) ci.real();
sample.m_imag = (FixReal) ci.imag();
}
void RemoteSourceSource::getSample()
{
Sample s;
m_dataReadQueue.readSample(s, true); // true is scale for Tx
m_modSample.real(s.m_real);
m_modSample.imag(s.m_imag);
}
void RemoteSourceSource::start()
@ -267,17 +237,6 @@ void RemoteSourceSource::applyChannelSettings(int channelSampleRate, bool force)
{
qDebug() << "RemoteSourceSource::applyChannelSettings:"
<< " channelSampleRate: " << channelSampleRate
<< " m_currentMeta.m_sampleRate: " << m_currentMeta.m_sampleRate
<< " force: " << force;
if ((channelSampleRate != m_channelSampleRate) || force)
{
uint32_t metaSampleRate = m_currentMeta.m_sampleRate == 0 ? channelSampleRate : m_currentMeta.m_sampleRate;
m_interpolatorDistanceRemain = 0;
m_interpolatorConsumed = false;
m_interpolatorDistance = (Real) metaSampleRate / (Real) channelSampleRate;
m_interpolator.create(48, metaSampleRate, metaSampleRate / 2.2, 3.0);
}
m_channelSampleRate = channelSampleRate;
}

View File

@ -24,7 +24,6 @@
#include "cm256cc/cm256.h"
#include "dsp/channelsamplesource.h"
#include "dsp/interpolator.h"
#include "channel/remotedatablock.h"
#include "channel/remotedataqueue.h"
#include "channel/remotedatareadqueue.h"
@ -72,17 +71,11 @@ private:
uint32_t m_nbUncorrectableErrors; //!< count of uncorrectable errors in number of blocks
int m_channelSampleRate;
Interpolator m_interpolator;
Real m_interpolatorDistance;
Real m_interpolatorDistanceRemain;
bool m_interpolatorConsumed;
Complex m_modSample;
void startWorker();
void stopWorker();
void handleDataFrame(RemoteDataFrame *dataFrame);
void printMeta(const QString& header, RemoteMetaDataFEC *metaData);
void getSample();
private slots:
void handleData();

View File

@ -51,7 +51,8 @@ const uint32_t RemoteOutput::NbSamplesForRateCorrection = 5000000;
RemoteOutput::RemoteOutput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_centerFrequency(0),
m_centerFrequency(435000000),
m_sampleRate(48000),
m_remoteOutputWorker(nullptr),
m_deviceDescription("RemoteOutput"),
m_startingTimeStamp(0),
@ -72,6 +73,8 @@ RemoteOutput::RemoteOutput(DeviceAPI *deviceAPI) :
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
connect(&m_masterTimer, SIGNAL(timeout()), this, SLOT(tick()));
applyCenterFrequency();
applySampleRate();
}
RemoteOutput::~RemoteOutput()
@ -94,7 +97,7 @@ bool RemoteOutput::start()
m_remoteOutputWorker = new RemoteOutputWorker(&m_sampleSourceFifo);
m_remoteOutputWorker->moveToThread(&m_remoteOutputWorkerThread);
m_remoteOutputWorker->setDataAddress(m_settings.m_dataAddress, m_settings.m_dataPort);
m_remoteOutputWorker->setSamplerate(m_settings.m_sampleRate);
m_remoteOutputWorker->setSamplerate(m_sampleRate);
m_remoteOutputWorker->setNbBlocksFEC(m_settings.m_nbFECBlocks);
m_remoteOutputWorker->connectTimer(m_masterTimer);
startWorker();
@ -177,7 +180,7 @@ const QString& RemoteOutput::getDeviceDescription() const
int RemoteOutput::getSampleRate() const
{
return m_settings.m_sampleRate;
return m_sampleRate;
}
quint64 RemoteOutput::getCenterFrequency() const
@ -270,7 +273,6 @@ bool RemoteOutput::handleMessage(const Message& message)
void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool force)
{
QMutexLocker mutexLocker(&m_mutex);
bool forwardChange = false;
QList<QString> reverseAPIKeys;
if ((m_settings.m_dataAddress != settings.m_dataAddress) || force) {
@ -293,20 +295,6 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc
}
}
if (force || (m_settings.m_sampleRate != settings.m_sampleRate))
{
reverseAPIKeys.append("sampleRate");
if (m_remoteOutputWorker != 0) {
m_remoteOutputWorker->setSamplerate(settings.m_sampleRate);
}
m_tickMultiplier = (21*NbSamplesForRateCorrection) / (2*settings.m_sampleRate); // two times per sample filling period plus small extension
m_tickMultiplier /= 20; // greter tick (one per second)
m_tickMultiplier = m_tickMultiplier < 1 ? 1 : m_tickMultiplier; // not below 1 second
forwardChange = true;
}
if (force || (m_settings.m_nbFECBlocks != settings.m_nbFECBlocks))
{
reverseAPIKeys.append("nbFECBlocks");
@ -319,19 +307,12 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc
mutexLocker.unlock();
qDebug() << "RemoteOutput::applySettings:"
<< " m_sampleRate: " << settings.m_sampleRate
<< " m_nbFECBlocks: " << settings.m_nbFECBlocks
<< " m_apiAddress: " << settings.m_apiAddress
<< " m_apiPort: " << settings.m_apiPort
<< " m_dataAddress: " << settings.m_dataAddress
<< " m_dataPort: " << settings.m_dataPort;
if (forwardChange)
{
DSPSignalNotification *notif = new DSPSignalNotification(settings.m_sampleRate, m_centerFrequency);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
if (settings.m_useReverseAPI)
{
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
@ -344,6 +325,26 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc
m_settings = settings;
}
void RemoteOutput::applyCenterFrequency()
{
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
void RemoteOutput::applySampleRate()
{
if (m_remoteOutputWorker) {
m_remoteOutputWorker->setSamplerate(m_sampleRate);
}
m_tickMultiplier = (21*NbSamplesForRateCorrection) / (2*m_sampleRate); // two times per sample filling period plus small extension
m_tickMultiplier /= 20; // greter tick (one per second)
m_tickMultiplier = m_tickMultiplier < 1 ? 1 : m_tickMultiplier; // not below 1 second
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
int RemoteOutput::webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage)
@ -411,9 +412,6 @@ void RemoteOutput::webapiUpdateDeviceSettings(
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response)
{
if (deviceSettingsKeys.contains("sampleRate")) {
settings.m_sampleRate = response.getRemoteOutputSettings()->getSampleRate();
}
if (deviceSettingsKeys.contains("nbFECBlocks")) {
settings.m_nbFECBlocks = response.getRemoteOutputSettings()->getNbFecBlocks();
}
@ -462,7 +460,6 @@ int RemoteOutput::webapiReportGet(
void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteOutputSettings& settings)
{
response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate);
response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks);
response.getRemoteOutputSettings()->setApiAddress(new QString(settings.m_apiAddress));
response.getRemoteOutputSettings()->setApiPort(settings.m_apiPort);
@ -485,6 +482,7 @@ void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
void RemoteOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
response.getRemoteOutputReport()->setCenterFrequency(m_centerFrequency);
response.getRemoteOutputReport()->setSampleRate(m_sampleRate);
response.getRemoteOutputReport()->setBufferRwBalance(m_sampleSourceFifo.getRWBalance());
response.getRemoteOutputReport()->setSampleCount(m_remoteOutputWorker ? (int) m_remoteOutputWorker->getSamplesCount() : 0);
}
@ -550,8 +548,25 @@ void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString&
{
MsgReportRemoteData::RemoteData msgRemoteData;
QJsonObject report = jsonObject["RemoteSourceReport"].toObject();
m_centerFrequency = report["deviceCenterFreq"].toInt();
uint64_t centerFrequency = report["deviceCenterFreq"].toInt();
if (centerFrequency != m_centerFrequency)
{
m_centerFrequency = centerFrequency;
applyCenterFrequency();
}
int remoteRate = report["deviceSampleRate"].toInt();
if (remoteRate != m_sampleRate)
{
m_sampleRate = remoteRate;
applySampleRate();
}
msgRemoteData.m_centerFrequency = m_centerFrequency;
msgRemoteData.m_sampleRate = m_sampleRate;
int queueSize = report["queueSize"].toInt();
queueSize = queueSize == 0 ? 20 : queueSize;
msgRemoteData.m_queueSize = queueSize;
@ -563,8 +578,6 @@ void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString&
int intRemoteSampleCount = report["samplesCount"].toInt();
uint32_t remoteSampleCount = intRemoteSampleCount < 0 ? 0 : intRemoteSampleCount;
msgRemoteData.m_sampleCount = remoteSampleCount;
int remoteRate = report["deviceSampleRate"].toInt();
msgRemoteData.m_sampleRate = remoteRate;
int unrecoverableCount = report["uncorrectableErrorsCount"].toInt();
msgRemoteData.m_unrecoverableCount = unrecoverableCount;
int recoverableCount = report["correctableErrorsCount"].toInt();
@ -696,9 +709,6 @@ void RemoteOutput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
// transfer data that has been modified. When force is on transfer all data except reverse API data
if (deviceSettingsKeys.contains("sampleRate") || force) {
swgRemoteOutputSettings->setSampleRate(settings.m_sampleRate);
}
if (deviceSettingsKeys.contains("nbFECBlocks") || force) {
swgRemoteOutputSettings->setNbFecBlocks(settings.m_nbFECBlocks);
}

View File

@ -275,6 +275,7 @@ private:
QMutex m_mutex;
RemoteOutputSettings m_settings;
uint64_t m_centerFrequency;
int m_sampleRate;
RemoteOutputWorker* m_remoteOutputWorker;
QThread m_remoteOutputWorkerThread;
QString m_deviceDescription;
@ -300,6 +301,8 @@ private:
void startWorker();
void stopWorker();
void applySettings(const RemoteOutputSettings& settings, bool force = false);
void applyCenterFrequency();
void applySampleRate();
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
void analyzeApiReply(const QJsonObject& jsonObject, const QString& answer);

View File

@ -55,7 +55,8 @@ RemoteOutputSinkGui::RemoteOutputSinkGui(DeviceUISet *deviceUISet, QWidget* pare
m_nbSinceLastFlowCheck(0),
m_lastEngineState(DeviceAPI::StNotStarted),
m_doApplySettings(true),
m_forceSettings(true)
m_forceSettings(true),
m_remoteAPIConnected(false)
{
m_countUnrecoverable = 0;
m_countRecovered = 0;
@ -69,11 +70,6 @@ RemoteOutputSinkGui::RemoteOutputSinkGui(DeviceUISet *deviceUISet, QWidget* pare
ui->setupUi(this);
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
ui->sampleRate->setValueRange(7, 32000U, 9000000U);
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@ -215,7 +211,6 @@ void RemoteOutputSinkGui::displaySettings()
{
blockApplySettings(true);
ui->centerFrequency->setText(QString("%L1").arg(m_deviceCenterFrequency));
ui->sampleRate->setValue(m_settings.m_sampleRate);
ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks);
QString s0 = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0);
@ -276,12 +271,6 @@ void RemoteOutputSinkGui::updateStatus()
}
}
void RemoteOutputSinkGui::on_sampleRate_changed(quint64 value)
{
m_settings.m_sampleRate = value;
sendSettings();
}
void RemoteOutputSinkGui::on_nbFECBlocks_valueChanged(int value)
{
m_settings.m_nbFECBlocks = value;
@ -457,6 +446,17 @@ void RemoteOutputSinkGui::displayEventTimer()
void RemoteOutputSinkGui::tick()
{
if (++m_tickCount == 20)
{
if (m_remoteAPIConnected) {
ui->apiAddressLabel->setStyleSheet("QLabel { background-color: green; }");
} else {
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
m_remoteAPIConnected = false;
m_tickCount = 0;
}
}
void RemoteOutputSinkGui::displayRemoteData(const RemoteOutput::MsgReportRemoteData::RemoteData& remoteData)
@ -476,6 +476,7 @@ void RemoteOutputSinkGui::displayRemoteData(const RemoteOutput::MsgReportRemoteD
m_countUnrecoverable += unrecoverableCountDelta;
displayEventCounts();
displayEventTimer();
m_remoteAPIConnected = true;
uint32_t sampleCountDelta;
@ -509,6 +510,7 @@ void RemoteOutputSinkGui::displayRemoteFixedData(const RemoteOutput::MsgReportRe
infoLine += " " + remoteData.m_architecture;
infoLine += " " + remoteData.m_os;
infoLine += QString(" %1/%2b").arg(remoteData.m_rxBits).arg(remoteData.m_txBits);
m_remoteAPIConnected = true;
if (infoLine.size() > 0) {
ui->infoText->setText(infoLine);

View File

@ -95,6 +95,7 @@ private:
int m_lastEngineState;
bool m_doApplySettings;
bool m_forceSettings;
bool m_remoteAPIConnected;
uint32_t m_countUnrecoverable;
uint32_t m_countRecovered;
@ -125,7 +126,6 @@ private:
private slots:
void handleInputMessages();
void on_sampleRate_changed(quint64 value);
void on_nbFECBlocks_valueChanged(int value);
void on_deviceIndex_returnPressed();
void on_channelIndex_returnPressed();

View File

@ -118,14 +118,14 @@
<widget class="QLabel" name="centerFrequency">
<property name="minimumSize">
<size>
<width>140</width>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>14</pointsize>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
@ -188,68 +188,6 @@
<property name="topMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="sampleRateLabel">
<property name="text">
<string>SR</string>
</property>
</widget>
</item>
<item>
<widget class="ValueDial" name="sampleRate" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Remote device sample rate</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sampleRateUnit">
<property name="text">
<string>S/s</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="deviceIndexLabel">
<property name="text">
@ -302,6 +240,19 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -754,12 +705,6 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>

View File

@ -25,7 +25,6 @@ RemoteOutputSettings::RemoteOutputSettings()
void RemoteOutputSettings::resetToDefaults()
{
m_sampleRate = 48000;
m_nbFECBlocks = 0;
m_apiAddress = "127.0.0.1";
m_apiPort = 9091;
@ -43,7 +42,6 @@ QByteArray RemoteOutputSettings::serialize() const
{
SimpleSerializer s(1);
s.writeU32(2, m_sampleRate);
s.writeU32(4, m_nbFECBlocks);
s.writeString(5, m_apiAddress);
s.writeU32(6, m_apiPort);
@ -73,7 +71,6 @@ bool RemoteOutputSettings::deserialize(const QByteArray& data)
{
quint32 uintval;
d.readU32(2, &m_sampleRate, 48000);
d.readU32(4, &m_nbFECBlocks, 0);
d.readString(5, &m_apiAddress, "127.0.0.1");
d.readU32(6, &uintval, 9090);

View File

@ -22,7 +22,6 @@
#include <QString>
struct RemoteOutputSettings {
quint32 m_sampleRate;
quint32 m_nbFECBlocks;
QString m_apiAddress;
quint16 m_apiPort;

View File

@ -9824,6 +9824,9 @@ margin-bottom: 20px;
"type" : "integer",
"format" : "int64"
},
"sampleRate" : {
"type" : "integer"
},
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
@ -9838,9 +9841,6 @@ margin-bottom: 20px;
};
defs.RemoteOutputSettings = {
"properties" : {
"sampleRate" : {
"type" : "integer"
},
"nbFECBlocks" : {
"type" : "integer"
},
@ -51597,7 +51597,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-12T13:16:20.821+01:00
Generated 2021-12-12T19:10:03.240+01:00
</div>
</div>
</div>

View File

@ -1,8 +1,6 @@
RemoteOutputSettings:
description: RemoteOutput
properties:
sampleRate:
type: integer
nbFECBlocks:
type: integer
apiAddress:
@ -35,6 +33,8 @@ RemoteOutputReport:
centerFrequency:
type: integer
format: int64
sampleRate:
type: integer
bufferRWBalance:
description: ratio off the mid buffer (positive read leads)
type: number

View File

@ -1,8 +1,6 @@
RemoteOutputSettings:
description: RemoteOutput
properties:
sampleRate:
type: integer
nbFECBlocks:
type: integer
apiAddress:
@ -35,6 +33,8 @@ RemoteOutputReport:
centerFrequency:
type: integer
format: int64
sampleRate:
type: integer
bufferRWBalance:
description: ratio off the mid buffer (positive read leads)
type: number

View File

@ -9824,6 +9824,9 @@ margin-bottom: 20px;
"type" : "integer",
"format" : "int64"
},
"sampleRate" : {
"type" : "integer"
},
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
@ -9838,9 +9841,6 @@ margin-bottom: 20px;
};
defs.RemoteOutputSettings = {
"properties" : {
"sampleRate" : {
"type" : "integer"
},
"nbFECBlocks" : {
"type" : "integer"
},
@ -51597,7 +51597,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-12T13:16:20.821+01:00
Generated 2021-12-12T19:10:03.240+01:00
</div>
</div>
</div>

View File

@ -30,6 +30,8 @@ SWGRemoteOutputReport::SWGRemoteOutputReport(QString* json) {
SWGRemoteOutputReport::SWGRemoteOutputReport() {
center_frequency = 0L;
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
sample_count = 0;
@ -44,6 +46,8 @@ void
SWGRemoteOutputReport::init() {
center_frequency = 0L;
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
sample_count = 0;
@ -55,6 +59,7 @@ SWGRemoteOutputReport::cleanup() {
}
SWGRemoteOutputReport*
@ -70,6 +75,8 @@ void
SWGRemoteOutputReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&buffer_rw_balance, pJson["bufferRWBalance"], "float", "");
::SWGSDRangel::setValue(&sample_count, pJson["sampleCount"], "qint32", "");
@ -93,6 +100,9 @@ SWGRemoteOutputReport::asJsonObject() {
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency));
}
if(m_sample_rate_isSet){
obj->insert("sampleRate", QJsonValue(sample_rate));
}
if(m_buffer_rw_balance_isSet){
obj->insert("bufferRWBalance", QJsonValue(buffer_rw_balance));
}
@ -113,6 +123,16 @@ SWGRemoteOutputReport::setCenterFrequency(qint64 center_frequency) {
this->m_center_frequency_isSet = true;
}
qint32
SWGRemoteOutputReport::getSampleRate() {
return sample_rate;
}
void
SWGRemoteOutputReport::setSampleRate(qint32 sample_rate) {
this->sample_rate = sample_rate;
this->m_sample_rate_isSet = true;
}
float
SWGRemoteOutputReport::getBufferRwBalance() {
return buffer_rw_balance;
@ -141,6 +161,9 @@ SWGRemoteOutputReport::isSet(){
if(m_center_frequency_isSet){
isObjectUpdated = true; break;
}
if(m_sample_rate_isSet){
isObjectUpdated = true; break;
}
if(m_buffer_rw_balance_isSet){
isObjectUpdated = true; break;
}

View File

@ -44,6 +44,9 @@ public:
qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency);
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
float getBufferRwBalance();
void setBufferRwBalance(float buffer_rw_balance);
@ -57,6 +60,9 @@ private:
qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 sample_rate;
bool m_sample_rate_isSet;
float buffer_rw_balance;
bool m_buffer_rw_balance_isSet;

View File

@ -28,8 +28,6 @@ SWGRemoteOutputSettings::SWGRemoteOutputSettings(QString* json) {
}
SWGRemoteOutputSettings::SWGRemoteOutputSettings() {
sample_rate = 0;
m_sample_rate_isSet = false;
nb_fec_blocks = 0;
m_nb_fec_blocks_isSet = false;
api_address = nullptr;
@ -60,8 +58,6 @@ SWGRemoteOutputSettings::~SWGRemoteOutputSettings() {
void
SWGRemoteOutputSettings::init() {
sample_rate = 0;
m_sample_rate_isSet = false;
nb_fec_blocks = 0;
m_nb_fec_blocks_isSet = false;
api_address = new QString("");
@ -89,7 +85,6 @@ SWGRemoteOutputSettings::init() {
void
SWGRemoteOutputSettings::cleanup() {
if(api_address != nullptr) {
delete api_address;
}
@ -119,8 +114,6 @@ SWGRemoteOutputSettings::fromJson(QString &json) {
void
SWGRemoteOutputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&nb_fec_blocks, pJson["nbFECBlocks"], "qint32", "");
::SWGSDRangel::setValue(&api_address, pJson["apiAddress"], "QString", "QString");
@ -159,9 +152,6 @@ SWGRemoteOutputSettings::asJson ()
QJsonObject*
SWGRemoteOutputSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_sample_rate_isSet){
obj->insert("sampleRate", QJsonValue(sample_rate));
}
if(m_nb_fec_blocks_isSet){
obj->insert("nbFECBlocks", QJsonValue(nb_fec_blocks));
}
@ -199,16 +189,6 @@ SWGRemoteOutputSettings::asJsonObject() {
return obj;
}
qint32
SWGRemoteOutputSettings::getSampleRate() {
return sample_rate;
}
void
SWGRemoteOutputSettings::setSampleRate(qint32 sample_rate) {
this->sample_rate = sample_rate;
this->m_sample_rate_isSet = true;
}
qint32
SWGRemoteOutputSettings::getNbFecBlocks() {
return nb_fec_blocks;
@ -324,9 +304,6 @@ bool
SWGRemoteOutputSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_sample_rate_isSet){
isObjectUpdated = true; break;
}
if(m_nb_fec_blocks_isSet){
isObjectUpdated = true; break;
}

View File

@ -42,9 +42,6 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGRemoteOutputSettings* fromJson(QString &jsonString) override;
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
qint32 getNbFecBlocks();
void setNbFecBlocks(qint32 nb_fec_blocks);
@ -82,9 +79,6 @@ public:
virtual bool isSet() override;
private:
qint32 sample_rate;
bool m_sample_rate_isSet;
qint32 nb_fec_blocks;
bool m_nb_fec_blocks_isSet;