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

Remote Output: improve report API

This commit is contained in:
f4exb 2021-12-15 22:56:18 +01:00
parent 54866a1a1e
commit 9097e2f6d4
9 changed files with 275 additions and 69 deletions

View File

@ -187,7 +187,7 @@ public:
virtual void getIdentifier(QString& id) { id = objectName(); }
virtual void getTitle(QString& title) { title = m_settings.m_title; }
virtual qint64 getCenterFrequency() const { return 0; }
virtual qint64 getCenterFrequency() const { return m_frequencyOffset; }
virtual int getNbSinkStreams() const { return 0; }
virtual int getNbSourceStreams() const { return 1; }

View File

@ -29,6 +29,7 @@
#include "SWGRemoteOutputReport.h"
#include "util/simpleserializer.h"
#include "util/timeutil.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
@ -41,7 +42,6 @@ MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgConfigureRemoteOutput, Message)
MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgConfigureRemoteOutputWork, Message)
MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgConfigureRemoteOutputChunkCorrection, Message)
MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgConfigureRemoteOutputSampleRate, Message)
MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgReportRemoteData, Message)
MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgReportRemoteFixedData, Message)
MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgRequestFixedData, Message)
@ -57,7 +57,11 @@ RemoteOutput::RemoteOutput(DeviceAPI *deviceAPI) :
m_masterTimer(deviceAPI->getMasterTimer()),
m_tickCount(0),
m_greaterTickCount(0),
m_tickMultiplier(1)
m_tickMultiplier(1),
m_queueLength(0),
m_queueSize(0),
m_recoverableCount(0),
m_unrecoverableCount(0)
{
m_deviceAPI->setNbSinkStreams(1);
m_networkManager = new QNetworkAccessManager();
@ -466,10 +470,16 @@ void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
void RemoteOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
uint64_t nowus = TimeUtil::nowus();
response.getRemoteOutputReport()->setTvSec(nowus / 1000000U);
response.getRemoteOutputReport()->setTvUSec(nowus % 1000000U);
response.getRemoteOutputReport()->setCenterFrequency(m_centerFrequency);
response.getRemoteOutputReport()->setSampleRate(m_sampleRate);
response.getRemoteOutputReport()->setBufferRwBalance(m_sampleSourceFifo.getRWBalance());
response.getRemoteOutputReport()->setQueueSize(m_queueSize);
response.getRemoteOutputReport()->setQueueLength(m_queueLength);
response.getRemoteOutputReport()->setSampleCount(m_remoteOutputWorker ? (int) m_remoteOutputWorker->getSamplesCount() : 0);
response.getRemoteOutputReport()->setCorrectableErrorsCount(m_recoverableCount);
response.getRemoteOutputReport()->setUncorrectableErrorsCount(m_unrecoverableCount);
}
void RemoteOutput::tick()
@ -552,20 +562,20 @@ void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString&
msgRemoteData.m_centerFrequency = m_centerFrequency;
msgRemoteData.m_sampleRate = m_sampleRate;
int queueSize = report["queueSize"].toInt();
queueSize = queueSize == 0 ? 20 : queueSize;
msgRemoteData.m_queueSize = queueSize;
int queueLength = report["queueLength"].toInt();
msgRemoteData.m_queueLength = queueLength;
m_queueSize = report["queueSize"].toInt();
m_queueSize = m_queueSize == 0 ? 20 : m_queueSize;
msgRemoteData.m_queueSize = m_queueSize;
m_queueLength = report["queueLength"].toInt();
msgRemoteData.m_queueLength = m_queueLength;
uint64_t remoteTimestampUs = report["tvSec"].toInt()*1000000ULL + report["tvUSec"].toInt();
msgRemoteData.m_timestampUs = remoteTimestampUs;
int intRemoteSampleCount = report["samplesCount"].toInt();
uint32_t remoteSampleCount = intRemoteSampleCount < 0 ? 0 : intRemoteSampleCount;
msgRemoteData.m_sampleCount = remoteSampleCount;
int unrecoverableCount = report["uncorrectableErrorsCount"].toInt();
msgRemoteData.m_unrecoverableCount = unrecoverableCount;
int recoverableCount = report["correctableErrorsCount"].toInt();
msgRemoteData.m_recoverableCount = recoverableCount;
m_unrecoverableCount = report["uncorrectableErrorsCount"].toInt();
msgRemoteData.m_unrecoverableCount = m_unrecoverableCount;
m_recoverableCount = report["correctableErrorsCount"].toInt();
msgRemoteData.m_recoverableCount = m_recoverableCount;
if (m_guiMessageQueue)
{
@ -579,7 +589,7 @@ void RemoteOutput::analyzeApiReply(const QJsonObject& jsonObject, const QString&
if (++m_greaterTickCount == m_tickMultiplier)
{
queueLengthCompensation(m_sampleRate, queueLength, queueSize);
queueLengthCompensation(m_sampleRate, m_queueLength, m_queueSize);
m_greaterTickCount = 0;
}
}

View File

@ -123,25 +123,6 @@ public:
{ }
};
class MsgConfigureRemoteOutputSampleRate : public Message {
MESSAGE_CLASS_DECLARATION
public:
int getSampleRate() const { return m_sampleRate; }
static MsgConfigureRemoteOutputSampleRate* create(int sampleRate) {
return new MsgConfigureRemoteOutputSampleRate(sampleRate);
}
private:
int m_sampleRate;
MsgConfigureRemoteOutputSampleRate(int sampleRate) :
Message(),
m_sampleRate(sampleRate)
{ }
};
class MsgReportRemoteData : public Message {
MESSAGE_CLASS_DECLARATION
@ -284,6 +265,10 @@ private:
uint32_t m_tickCount; // for 50 ms timer
uint32_t m_greaterTickCount; // for 1 s derived timer
uint32_t m_tickMultiplier; // for greater tick count
int m_queueLength;
int m_queueSize;
int m_recoverableCount;
int m_unrecoverableCount;
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;

View File

@ -9827,14 +9827,33 @@ margin-bottom: 20px;
"sampleRate" : {
"type" : "integer"
},
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
"description" : "ratio off the mid buffer (positive read leads)"
"queueLength" : {
"type" : "integer",
"description" : "Data read/write queue length in number of data frames"
},
"queueSize" : {
"type" : "integer",
"description" : "Data read/write queue size in number of data frames"
},
"sampleCount" : {
"type" : "integer",
"description" : "count of samples that have been sent"
},
"correctableErrorsCount" : {
"type" : "integer",
"description" : "Absolute number of correctable errors"
},
"uncorrectableErrorsCount" : {
"type" : "integer",
"description" : "Absolute number of uncorrectable errors"
},
"tvSec" : {
"type" : "integer",
"description" : "Counts timestamp seconds"
},
"tvUSec" : {
"type" : "integer",
"description" : "Counts timestamp microseconds"
}
},
"description" : "RemoteOutput"
@ -51603,7 +51622,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-12T22:32:39.234+01:00
Generated 2021-12-15T21:39:08.842+01:00
</div>
</div>
</div>

View File

@ -35,10 +35,24 @@ RemoteOutputReport:
format: int64
sampleRate:
type: integer
bufferRWBalance:
description: ratio off the mid buffer (positive read leads)
type: number
format: float
queueLength:
description: "Data read/write queue length in number of data frames"
type: integer
queueSize:
description: "Data read/write queue size in number of data frames"
type: integer
sampleCount:
description: count of samples that have been sent
type: integer
correctableErrorsCount:
description: "Absolute number of correctable errors"
type: integer
uncorrectableErrorsCount:
description: "Absolute number of uncorrectable errors"
type: integer
tvSec:
description: "Counts timestamp seconds"
type: integer
tvUSec:
description: "Counts timestamp microseconds"
type: integer

View File

@ -35,10 +35,24 @@ RemoteOutputReport:
format: int64
sampleRate:
type: integer
bufferRWBalance:
description: ratio off the mid buffer (positive read leads)
type: number
format: float
queueLength:
description: "Data read/write queue length in number of data frames"
type: integer
queueSize:
description: "Data read/write queue size in number of data frames"
type: integer
sampleCount:
description: count of samples that have been sent
type: integer
correctableErrorsCount:
description: "Absolute number of correctable errors"
type: integer
uncorrectableErrorsCount:
description: "Absolute number of uncorrectable errors"
type: integer
tvSec:
description: "Counts timestamp seconds"
type: integer
tvUSec:
description: "Counts timestamp microseconds"
type: integer

View File

@ -9827,14 +9827,33 @@ margin-bottom: 20px;
"sampleRate" : {
"type" : "integer"
},
"bufferRWBalance" : {
"type" : "number",
"format" : "float",
"description" : "ratio off the mid buffer (positive read leads)"
"queueLength" : {
"type" : "integer",
"description" : "Data read/write queue length in number of data frames"
},
"queueSize" : {
"type" : "integer",
"description" : "Data read/write queue size in number of data frames"
},
"sampleCount" : {
"type" : "integer",
"description" : "count of samples that have been sent"
},
"correctableErrorsCount" : {
"type" : "integer",
"description" : "Absolute number of correctable errors"
},
"uncorrectableErrorsCount" : {
"type" : "integer",
"description" : "Absolute number of uncorrectable errors"
},
"tvSec" : {
"type" : "integer",
"description" : "Counts timestamp seconds"
},
"tvUSec" : {
"type" : "integer",
"description" : "Counts timestamp microseconds"
}
},
"description" : "RemoteOutput"
@ -51603,7 +51622,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-12T22:32:39.234+01:00
Generated 2021-12-15T21:39:08.842+01:00
</div>
</div>
</div>

View File

@ -32,10 +32,20 @@ SWGRemoteOutputReport::SWGRemoteOutputReport() {
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
queue_length = 0;
m_queue_length_isSet = false;
queue_size = 0;
m_queue_size_isSet = false;
sample_count = 0;
m_sample_count_isSet = false;
correctable_errors_count = 0;
m_correctable_errors_count_isSet = false;
uncorrectable_errors_count = 0;
m_uncorrectable_errors_count_isSet = false;
tv_sec = 0;
m_tv_sec_isSet = false;
tv_u_sec = 0;
m_tv_u_sec_isSet = false;
}
SWGRemoteOutputReport::~SWGRemoteOutputReport() {
@ -48,10 +58,20 @@ SWGRemoteOutputReport::init() {
m_center_frequency_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
buffer_rw_balance = 0.0f;
m_buffer_rw_balance_isSet = false;
queue_length = 0;
m_queue_length_isSet = false;
queue_size = 0;
m_queue_size_isSet = false;
sample_count = 0;
m_sample_count_isSet = false;
correctable_errors_count = 0;
m_correctable_errors_count_isSet = false;
uncorrectable_errors_count = 0;
m_uncorrectable_errors_count_isSet = false;
tv_sec = 0;
m_tv_sec_isSet = false;
tv_u_sec = 0;
m_tv_u_sec_isSet = false;
}
void
@ -60,6 +80,11 @@ SWGRemoteOutputReport::cleanup() {
}
SWGRemoteOutputReport*
@ -77,10 +102,20 @@ SWGRemoteOutputReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&buffer_rw_balance, pJson["bufferRWBalance"], "float", "");
::SWGSDRangel::setValue(&queue_length, pJson["queueLength"], "qint32", "");
::SWGSDRangel::setValue(&queue_size, pJson["queueSize"], "qint32", "");
::SWGSDRangel::setValue(&sample_count, pJson["sampleCount"], "qint32", "");
::SWGSDRangel::setValue(&correctable_errors_count, pJson["correctableErrorsCount"], "qint32", "");
::SWGSDRangel::setValue(&uncorrectable_errors_count, pJson["uncorrectableErrorsCount"], "qint32", "");
::SWGSDRangel::setValue(&tv_sec, pJson["tvSec"], "qint32", "");
::SWGSDRangel::setValue(&tv_u_sec, pJson["tvUSec"], "qint32", "");
}
QString
@ -103,12 +138,27 @@ SWGRemoteOutputReport::asJsonObject() {
if(m_sample_rate_isSet){
obj->insert("sampleRate", QJsonValue(sample_rate));
}
if(m_buffer_rw_balance_isSet){
obj->insert("bufferRWBalance", QJsonValue(buffer_rw_balance));
if(m_queue_length_isSet){
obj->insert("queueLength", QJsonValue(queue_length));
}
if(m_queue_size_isSet){
obj->insert("queueSize", QJsonValue(queue_size));
}
if(m_sample_count_isSet){
obj->insert("sampleCount", QJsonValue(sample_count));
}
if(m_correctable_errors_count_isSet){
obj->insert("correctableErrorsCount", QJsonValue(correctable_errors_count));
}
if(m_uncorrectable_errors_count_isSet){
obj->insert("uncorrectableErrorsCount", QJsonValue(uncorrectable_errors_count));
}
if(m_tv_sec_isSet){
obj->insert("tvSec", QJsonValue(tv_sec));
}
if(m_tv_u_sec_isSet){
obj->insert("tvUSec", QJsonValue(tv_u_sec));
}
return obj;
}
@ -133,14 +183,24 @@ SWGRemoteOutputReport::setSampleRate(qint32 sample_rate) {
this->m_sample_rate_isSet = true;
}
float
SWGRemoteOutputReport::getBufferRwBalance() {
return buffer_rw_balance;
qint32
SWGRemoteOutputReport::getQueueLength() {
return queue_length;
}
void
SWGRemoteOutputReport::setBufferRwBalance(float buffer_rw_balance) {
this->buffer_rw_balance = buffer_rw_balance;
this->m_buffer_rw_balance_isSet = true;
SWGRemoteOutputReport::setQueueLength(qint32 queue_length) {
this->queue_length = queue_length;
this->m_queue_length_isSet = true;
}
qint32
SWGRemoteOutputReport::getQueueSize() {
return queue_size;
}
void
SWGRemoteOutputReport::setQueueSize(qint32 queue_size) {
this->queue_size = queue_size;
this->m_queue_size_isSet = true;
}
qint32
@ -153,6 +213,46 @@ SWGRemoteOutputReport::setSampleCount(qint32 sample_count) {
this->m_sample_count_isSet = true;
}
qint32
SWGRemoteOutputReport::getCorrectableErrorsCount() {
return correctable_errors_count;
}
void
SWGRemoteOutputReport::setCorrectableErrorsCount(qint32 correctable_errors_count) {
this->correctable_errors_count = correctable_errors_count;
this->m_correctable_errors_count_isSet = true;
}
qint32
SWGRemoteOutputReport::getUncorrectableErrorsCount() {
return uncorrectable_errors_count;
}
void
SWGRemoteOutputReport::setUncorrectableErrorsCount(qint32 uncorrectable_errors_count) {
this->uncorrectable_errors_count = uncorrectable_errors_count;
this->m_uncorrectable_errors_count_isSet = true;
}
qint32
SWGRemoteOutputReport::getTvSec() {
return tv_sec;
}
void
SWGRemoteOutputReport::setTvSec(qint32 tv_sec) {
this->tv_sec = tv_sec;
this->m_tv_sec_isSet = true;
}
qint32
SWGRemoteOutputReport::getTvUSec() {
return tv_u_sec;
}
void
SWGRemoteOutputReport::setTvUSec(qint32 tv_u_sec) {
this->tv_u_sec = tv_u_sec;
this->m_tv_u_sec_isSet = true;
}
bool
SWGRemoteOutputReport::isSet(){
@ -164,12 +264,27 @@ SWGRemoteOutputReport::isSet(){
if(m_sample_rate_isSet){
isObjectUpdated = true; break;
}
if(m_buffer_rw_balance_isSet){
if(m_queue_length_isSet){
isObjectUpdated = true; break;
}
if(m_queue_size_isSet){
isObjectUpdated = true; break;
}
if(m_sample_count_isSet){
isObjectUpdated = true; break;
}
if(m_correctable_errors_count_isSet){
isObjectUpdated = true; break;
}
if(m_uncorrectable_errors_count_isSet){
isObjectUpdated = true; break;
}
if(m_tv_sec_isSet){
isObjectUpdated = true; break;
}
if(m_tv_u_sec_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}

View File

@ -47,12 +47,27 @@ public:
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
float getBufferRwBalance();
void setBufferRwBalance(float buffer_rw_balance);
qint32 getQueueLength();
void setQueueLength(qint32 queue_length);
qint32 getQueueSize();
void setQueueSize(qint32 queue_size);
qint32 getSampleCount();
void setSampleCount(qint32 sample_count);
qint32 getCorrectableErrorsCount();
void setCorrectableErrorsCount(qint32 correctable_errors_count);
qint32 getUncorrectableErrorsCount();
void setUncorrectableErrorsCount(qint32 uncorrectable_errors_count);
qint32 getTvSec();
void setTvSec(qint32 tv_sec);
qint32 getTvUSec();
void setTvUSec(qint32 tv_u_sec);
virtual bool isSet() override;
@ -63,12 +78,27 @@ private:
qint32 sample_rate;
bool m_sample_rate_isSet;
float buffer_rw_balance;
bool m_buffer_rw_balance_isSet;
qint32 queue_length;
bool m_queue_length_isSet;
qint32 queue_size;
bool m_queue_size_isSet;
qint32 sample_count;
bool m_sample_count_isSet;
qint32 correctable_errors_count;
bool m_correctable_errors_count_isSet;
qint32 uncorrectable_errors_count;
bool m_uncorrectable_errors_count_isSet;
qint32 tv_sec;
bool m_tv_sec_isSet;
qint32 tv_u_sec;
bool m_tv_u_sec_isSet;
};
}