1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 15:51:47 -05:00

Remote Output: removed center frequency from settings but add it to the device report

This commit is contained in:
f4exb 2021-12-12 13:45:14 +01:00
parent a5948c8b24
commit 56ba6f3d80
18 changed files with 67 additions and 74 deletions

View File

@ -369,7 +369,7 @@ void RemoteSource::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& resp
response.getRemoteSourceReport()->setNbFecBlocks(currentMeta.m_nbFECBlocks);
response.getRemoteSourceReport()->setCenterFreq(currentMeta.m_centerFrequency);
response.getRemoteSourceReport()->setSampleRate(currentMeta.m_sampleRate);
response.getRemoteSourceReport()->setDeviceCenterFreq(m_deviceAPI->getSampleSink()->getCenterFrequency()/1000);
response.getRemoteSourceReport()->setDeviceCenterFreq(m_deviceAPI->getSampleSink()->getCenterFrequency());
response.getRemoteSourceReport()->setDeviceSampleRate(m_deviceAPI->getSampleSink()->getSampleRate());
}

View File

@ -462,7 +462,6 @@ int RemoteOutput::webapiReportGet(
void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RemoteOutputSettings& settings)
{
response.getRemoteOutputSettings()->setCenterFrequency(settings.m_centerFrequency);
response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate);
response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks);
response.getRemoteOutputSettings()->setApiAddress(new QString(settings.m_apiAddress));
@ -485,6 +484,7 @@ void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
void RemoteOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
response.getRemoteOutputReport()->setCenterFrequency(m_centerFrequency);
response.getRemoteOutputReport()->setBufferRwBalance(m_sampleSourceFifo.getRWBalance());
response.getRemoteOutputReport()->setSampleCount(m_remoteOutputWorker ? (int) m_remoteOutputWorker->getSamplesCount() : 0);
}
@ -550,8 +550,7 @@ void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString&
{
MsgReportRemoteData::RemoteData msgRemoteData;
QJsonObject report = jsonObject["RemoteSourceReport"].toObject();
m_settings.m_centerFrequency = report["deviceCenterFreq"].toInt();
m_centerFrequency = m_settings.m_centerFrequency * 1000;
m_centerFrequency = report["deviceCenterFreq"].toInt();
msgRemoteData.m_centerFrequency = m_centerFrequency;
int queueSize = report["queueSize"].toInt();
queueSize = queueSize == 0 ? 20 : queueSize;

View File

@ -62,7 +62,6 @@ RemoteOutputSinkGui::RemoteOutputSinkGui(DeviceUISet *deviceUISet, QWidget* pare
m_lastCountUnrecoverable = 0;
m_lastCountRecovered = 0;
m_lastSampleCount = 0;
m_resetCounts = true;
m_paletteGreenText.setColor(QPalette::WindowText, Qt::green);
m_paletteRedText.setColor(QPalette::WindowText, Qt::red);
@ -470,16 +469,13 @@ void RemoteOutputSinkGui::displayRemoteData(const RemoteOutput::MsgReportRemoteD
ui->queueLengthText->setText(queueLengthText);
int queueLengthPercent = (remoteData.m_queueLength*100)/remoteData.m_queueSize;
ui->queueLengthGauge->setValue(queueLengthPercent);
if (!m_resetCounts)
{
int recoverableCountDelta = remoteData.m_recoverableCount - m_lastCountRecovered;
int unrecoverableCountDelta = remoteData.m_unrecoverableCount - m_lastCountUnrecoverable;
displayEventStatus(recoverableCountDelta, unrecoverableCountDelta);
m_countRecovered += recoverableCountDelta;
m_countUnrecoverable += unrecoverableCountDelta;
displayEventCounts();
}
int recoverableCountDelta = remoteData.m_recoverableCount - m_lastCountRecovered;
int unrecoverableCountDelta = remoteData.m_unrecoverableCount - m_lastCountUnrecoverable;
displayEventStatus(recoverableCountDelta, unrecoverableCountDelta);
m_countRecovered += recoverableCountDelta;
m_countUnrecoverable += unrecoverableCountDelta;
displayEventCounts();
displayEventTimer();
uint32_t sampleCountDelta;
@ -500,7 +496,6 @@ void RemoteOutputSinkGui::displayRemoteData(const RemoteOutput::MsgReportRemoteD
ui->remoteStreamRateText->setText(QString("%1").arg(remoteStreamRate, 0, 'f', 0));
}
m_resetCounts = false;
m_lastCountRecovered = remoteData.m_recoverableCount;
m_lastCountUnrecoverable = remoteData.m_unrecoverableCount;
m_lastSampleCount = remoteData.m_sampleCount;

View File

@ -102,7 +102,6 @@ private:
uint32_t m_lastCountRecovered;
uint32_t m_lastSampleCount;
uint64_t m_lastTimestampUs;
bool m_resetCounts;
QElapsedTimer m_time;
QPalette m_paletteGreenText;

View File

@ -25,7 +25,6 @@ RemoteOutputSettings::RemoteOutputSettings()
void RemoteOutputSettings::resetToDefaults()
{
m_centerFrequency = 435000*1000;
m_sampleRate = 48000;
m_nbFECBlocks = 0;
m_apiAddress = "127.0.0.1";
@ -44,7 +43,6 @@ QByteArray RemoteOutputSettings::serialize() const
{
SimpleSerializer s(1);
s.writeU64(1, m_centerFrequency);
s.writeU32(2, m_sampleRate);
s.writeU32(4, m_nbFECBlocks);
s.writeString(5, m_apiAddress);
@ -75,7 +73,6 @@ bool RemoteOutputSettings::deserialize(const QByteArray& data)
{
quint32 uintval;
d.readU64(1, &m_centerFrequency, 435000*1000);
d.readU32(2, &m_sampleRate, 48000);
d.readU32(4, &m_nbFECBlocks, 0);
d.readString(5, &m_apiAddress, "127.0.0.1");

View File

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

View File

@ -9820,6 +9820,10 @@ margin-bottom: 20px;
};
defs.RemoteOutputReport = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
@ -9834,10 +9838,6 @@ margin-bottom: 20px;
};
defs.RemoteOutputSettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"sampleRate" : {
"type" : "integer"
},
@ -9970,6 +9970,7 @@ margin-bottom: 20px;
},
"centerFreq" : {
"type" : "integer",
"format" : "int64",
"description" : "Stream center frequency setting in kHz"
},
"sampleRate" : {
@ -51596,7 +51597,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-07T06:38:29.681+01:00
Generated 2021-12-12T13:16:20.821+01:00
</div>
</div>
</div>

View File

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

View File

@ -61,6 +61,7 @@ RemoteSourceReport:
centerFreq:
description: "Stream center frequency setting in kHz"
type: integer
format: int64
sampleRate:
description: "Stream nominal sample rate in S/s"
type: integer

View File

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

View File

@ -61,6 +61,7 @@ RemoteSourceReport:
centerFreq:
description: "Stream center frequency setting in kHz"
type: integer
format: int64
sampleRate:
description: "Stream nominal sample rate in S/s"
type: integer

View File

@ -9820,6 +9820,10 @@ margin-bottom: 20px;
};
defs.RemoteOutputReport = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
@ -9834,10 +9838,6 @@ margin-bottom: 20px;
};
defs.RemoteOutputSettings = {
"properties" : {
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"sampleRate" : {
"type" : "integer"
},
@ -9970,6 +9970,7 @@ margin-bottom: 20px;
},
"centerFreq" : {
"type" : "integer",
"format" : "int64",
"description" : "Stream center frequency setting in kHz"
},
"sampleRate" : {
@ -51596,7 +51597,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-07T06:38:29.681+01:00
Generated 2021-12-12T13:16:20.821+01:00
</div>
</div>
</div>

View File

@ -28,6 +28,8 @@ SWGRemoteOutputReport::SWGRemoteOutputReport(QString* json) {
}
SWGRemoteOutputReport::SWGRemoteOutputReport() {
center_frequency = 0L;
m_center_frequency_isSet = false;
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
sample_count = 0;
@ -40,6 +42,8 @@ SWGRemoteOutputReport::~SWGRemoteOutputReport() {
void
SWGRemoteOutputReport::init() {
center_frequency = 0L;
m_center_frequency_isSet = false;
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
sample_count = 0;
@ -50,6 +54,7 @@ void
SWGRemoteOutputReport::cleanup() {
}
SWGRemoteOutputReport*
@ -63,6 +68,8 @@ SWGRemoteOutputReport::fromJson(QString &json) {
void
SWGRemoteOutputReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&buffer_rw_balance, pJson["bufferRWBalance"], "float", "");
::SWGSDRangel::setValue(&sample_count, pJson["sampleCount"], "qint32", "");
@ -83,6 +90,9 @@ SWGRemoteOutputReport::asJson ()
QJsonObject*
SWGRemoteOutputReport::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency));
}
if(m_buffer_rw_balance_isSet){
obj->insert("bufferRWBalance", QJsonValue(buffer_rw_balance));
}
@ -93,6 +103,16 @@ SWGRemoteOutputReport::asJsonObject() {
return obj;
}
qint64
SWGRemoteOutputReport::getCenterFrequency() {
return center_frequency;
}
void
SWGRemoteOutputReport::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
}
float
SWGRemoteOutputReport::getBufferRwBalance() {
return buffer_rw_balance;
@ -118,6 +138,9 @@ bool
SWGRemoteOutputReport::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){
isObjectUpdated = true; break;
}
if(m_buffer_rw_balance_isSet){
isObjectUpdated = true; break;
}

View File

@ -41,6 +41,9 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGRemoteOutputReport* fromJson(QString &jsonString) override;
qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency);
float getBufferRwBalance();
void setBufferRwBalance(float buffer_rw_balance);
@ -51,6 +54,9 @@ public:
virtual bool isSet() override;
private:
qint64 center_frequency;
bool m_center_frequency_isSet;
float buffer_rw_balance;
bool m_buffer_rw_balance_isSet;

View File

@ -28,8 +28,6 @@ SWGRemoteOutputSettings::SWGRemoteOutputSettings(QString* json) {
}
SWGRemoteOutputSettings::SWGRemoteOutputSettings() {
center_frequency = 0L;
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
nb_fec_blocks = 0;
@ -62,8 +60,6 @@ SWGRemoteOutputSettings::~SWGRemoteOutputSettings() {
void
SWGRemoteOutputSettings::init() {
center_frequency = 0L;
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
nb_fec_blocks = 0;
@ -94,7 +90,6 @@ void
SWGRemoteOutputSettings::cleanup() {
if(api_address != nullptr) {
delete api_address;
}
@ -124,8 +119,6 @@ SWGRemoteOutputSettings::fromJson(QString &json) {
void
SWGRemoteOutputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&nb_fec_blocks, pJson["nbFECBlocks"], "qint32", "");
@ -166,9 +159,6 @@ SWGRemoteOutputSettings::asJson ()
QJsonObject*
SWGRemoteOutputSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency));
}
if(m_sample_rate_isSet){
obj->insert("sampleRate", QJsonValue(sample_rate));
}
@ -209,16 +199,6 @@ SWGRemoteOutputSettings::asJsonObject() {
return obj;
}
qint64
SWGRemoteOutputSettings::getCenterFrequency() {
return center_frequency;
}
void
SWGRemoteOutputSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
}
qint32
SWGRemoteOutputSettings::getSampleRate() {
return sample_rate;
@ -344,9 +324,6 @@ bool
SWGRemoteOutputSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){
isObjectUpdated = true; break;
}
if(m_sample_rate_isSet){
isObjectUpdated = true; break;
}

View File

@ -42,9 +42,6 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGRemoteOutputSettings* fromJson(QString &jsonString) override;
qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency);
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
@ -85,9 +82,6 @@ public:
virtual bool isSet() override;
private:
qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 sample_rate;
bool m_sample_rate_isSet;

View File

@ -46,7 +46,7 @@ SWGRemoteSourceReport::SWGRemoteSourceReport() {
m_nb_original_blocks_isSet = false;
nb_fec_blocks = 0;
m_nb_fec_blocks_isSet = false;
center_freq = 0;
center_freq = 0L;
m_center_freq_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
@ -80,7 +80,7 @@ SWGRemoteSourceReport::init() {
m_nb_original_blocks_isSet = false;
nb_fec_blocks = 0;
m_nb_fec_blocks_isSet = false;
center_freq = 0;
center_freq = 0L;
m_center_freq_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
@ -136,7 +136,7 @@ SWGRemoteSourceReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&nb_fec_blocks, pJson["nbFECBlocks"], "qint32", "");
::SWGSDRangel::setValue(&center_freq, pJson["centerFreq"], "qint32", "");
::SWGSDRangel::setValue(&center_freq, pJson["centerFreq"], "qint64", "");
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
@ -293,12 +293,12 @@ SWGRemoteSourceReport::setNbFecBlocks(qint32 nb_fec_blocks) {
this->m_nb_fec_blocks_isSet = true;
}
qint32
qint64
SWGRemoteSourceReport::getCenterFreq() {
return center_freq;
}
void
SWGRemoteSourceReport::setCenterFreq(qint32 center_freq) {
SWGRemoteSourceReport::setCenterFreq(qint64 center_freq) {
this->center_freq = center_freq;
this->m_center_freq_isSet = true;
}

View File

@ -68,8 +68,8 @@ public:
qint32 getNbFecBlocks();
void setNbFecBlocks(qint32 nb_fec_blocks);
qint32 getCenterFreq();
void setCenterFreq(qint32 center_freq);
qint64 getCenterFreq();
void setCenterFreq(qint64 center_freq);
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
@ -111,7 +111,7 @@ private:
qint32 nb_fec_blocks;
bool m_nb_fec_blocks_isSet;
qint32 center_freq;
qint64 center_freq;
bool m_center_freq_isSet;
qint32 sample_rate;