mirror of https://github.com/f4exb/sdrangel.git
Aaronia RSA Rx: implemented sample rate change
This commit is contained in:
parent
524180154a
commit
bf1558071e
|
@ -74,6 +74,9 @@ AaroniaRTSAGui::AaroniaRTSAGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->centerFrequency->setValueRange(9, 0, 999999999);
|
||||
|
||||
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
|
||||
ui->sampleRate->setValueRange(8, 2000U, 20000000U);
|
||||
|
||||
displaySettings();
|
||||
makeUIConnections();
|
||||
|
||||
|
@ -139,6 +142,13 @@ void AaroniaRTSAGui::on_centerFrequency_changed(quint64 value)
|
|||
sendSettings();
|
||||
}
|
||||
|
||||
void AaroniaRTSAGui::on_sampleRate_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_sampleRate = value;
|
||||
m_settingsKeys.append("sampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AaroniaRTSAGui::on_serverAddress_returnPressed()
|
||||
{
|
||||
on_serverAddressApplyButton_clicked();
|
||||
|
@ -295,6 +305,7 @@ void AaroniaRTSAGui::updateSampleRateAndFrequency()
|
|||
ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_deviceSampleRate / 1000.0f, 'g', 5)));
|
||||
blockApplySettings(true);
|
||||
ui->centerFrequency->setValue(m_deviceCenterFrequency / 1000);
|
||||
ui->sampleRate->setValue(m_deviceSampleRate);
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
|
@ -331,6 +342,7 @@ void AaroniaRTSAGui::makeUIConnections()
|
|||
{
|
||||
QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &AaroniaRTSAGui::on_startStop_toggled);
|
||||
QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &AaroniaRTSAGui::on_centerFrequency_changed);
|
||||
QObject::connect(ui->sampleRate, &ValueDial::changed, this, &AaroniaRTSAGui::on_sampleRate_changed);
|
||||
QObject::connect(ui->serverAddress, &QLineEdit::returnPressed, this, &AaroniaRTSAGui::on_serverAddress_returnPressed);
|
||||
QObject::connect(ui->serverAddressApplyButton, &QPushButton::clicked, this, &AaroniaRTSAGui::on_serverAddressApplyButton_clicked);
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ private slots:
|
|||
void handleInputMessages();
|
||||
void on_startStop_toggled(bool checked);
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
void on_sampleRate_changed(quint64 value);
|
||||
void on_serverAddress_returnPressed();
|
||||
void on_serverAddressApplyButton_clicked();
|
||||
void openDeviceSettingsDialog(const QPoint& p);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>106</height>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -19,13 +19,13 @@
|
|||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>106</height>
|
||||
<height>130</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>143</height>
|
||||
<height>131</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
|
@ -180,6 +180,71 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="sampleRateLayout">
|
||||
<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>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Device sample rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="rateUnits">
|
||||
<property name="text">
|
||||
<string>S/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="serverAddressLayout">
|
||||
<item>
|
||||
|
|
|
@ -110,6 +110,7 @@ bool AaroniaRTSAInput::start()
|
|||
QObject::connect(m_aaroniaRTSAWorkerThread, &QThread::finished, m_aaroniaRTSAWorkerThread, &QThread::deleteLater);
|
||||
|
||||
connect(this, &AaroniaRTSAInput::setWorkerCenterFrequency, m_aaroniaRTSAWorker, &AaroniaRTSAWorker::onCenterFrequencyChanged);
|
||||
connect(this, &AaroniaRTSAInput::setWorkerSampleRate, m_aaroniaRTSAWorker, &AaroniaRTSAWorker::onSampleRateChanged);
|
||||
connect(this, &AaroniaRTSAInput::setWorkerServerAddress, m_aaroniaRTSAWorker, &AaroniaRTSAWorker::onServerAddressChanged);
|
||||
connect(m_aaroniaRTSAWorker, &AaroniaRTSAWorker::updateStatus, this, &AaroniaRTSAInput::setWorkerStatus);
|
||||
|
||||
|
@ -295,6 +296,10 @@ bool AaroniaRTSAInput::applySettings(const AaroniaRTSASettings& settings, const
|
|||
// m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
}
|
||||
|
||||
if (settingsKeys.contains("sampleRate")) {
|
||||
emit setWorkerSampleRate(settings.m_sampleRate);
|
||||
}
|
||||
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
|
@ -383,6 +388,9 @@ void AaroniaRTSAInput::webapiUpdateDeviceSettings(
|
|||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getAaroniaRtsaSettings()->getCenterFrequency();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_sampleRate = response.getAaroniaRtsaSettings()->getSampleRate();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("serverAddress")) {
|
||||
settings.m_serverAddress = *response.getAaroniaRtsaSettings()->getServerAddress();
|
||||
}
|
||||
|
@ -414,6 +422,7 @@ int AaroniaRTSAInput::webapiReportGet(
|
|||
void AaroniaRTSAInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AaroniaRTSASettings& settings)
|
||||
{
|
||||
response.getAaroniaRtsaSettings()->setCenterFrequency(settings.m_centerFrequency);
|
||||
response.getAaroniaRtsaSettings()->setSampleRate(settings.m_sampleRate);
|
||||
|
||||
if (response.getAaroniaRtsaSettings()->getServerAddress()) {
|
||||
*response.getAaroniaRtsaSettings()->getServerAddress() = settings.m_serverAddress;
|
||||
|
|
|
@ -176,6 +176,7 @@ signals:
|
|||
void startWorker();
|
||||
void stopWorker();
|
||||
void setWorkerCenterFrequency(quint64 centerFrequency);
|
||||
void setWorkerSampleRate(int sampleRate);
|
||||
void setWorkerServerAddress(QString serverAddress);
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -27,6 +27,7 @@ AaroniaRTSASettings::AaroniaRTSASettings()
|
|||
void AaroniaRTSASettings::resetToDefaults()
|
||||
{
|
||||
m_centerFrequency = 1450000;
|
||||
m_sampleRate = 200000;
|
||||
m_serverAddress = "127.0.0.1:8073";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
|
@ -39,6 +40,7 @@ QByteArray AaroniaRTSASettings::serialize() const
|
|||
SimpleSerializer s(2);
|
||||
|
||||
s.writeString(2, m_serverAddress);
|
||||
s.writeS32(3, m_sampleRate);
|
||||
s.writeBool(100, m_useReverseAPI);
|
||||
s.writeString(101, m_reverseAPIAddress);
|
||||
s.writeU32(102, m_reverseAPIPort);
|
||||
|
@ -62,6 +64,7 @@ bool AaroniaRTSASettings::deserialize(const QByteArray& data)
|
|||
uint32_t utmp;
|
||||
|
||||
d.readString(2, &m_serverAddress, "127.0.0.1:8073");
|
||||
d.readS32(3, &m_sampleRate, 200000);
|
||||
d.readBool(100, &m_useReverseAPI, false);
|
||||
d.readString(101, &m_reverseAPIAddress, "127.0.0.1");
|
||||
d.readU32(102, &utmp, 0);
|
||||
|
@ -90,6 +93,9 @@ void AaroniaRTSASettings::applySettings(const QStringList& settingsKeys, const A
|
|||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("sampleRate")) {
|
||||
m_sampleRate = settings.m_sampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("serverAddress")) {
|
||||
m_serverAddress = settings.m_serverAddress;
|
||||
}
|
||||
|
@ -114,6 +120,9 @@ QString AaroniaRTSASettings::getDebugString(const QStringList& settingsKeys, boo
|
|||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("sampleRate") || force) {
|
||||
ostr << " m_sampleRate: " << m_sampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("serverAddress") || force) {
|
||||
ostr << " m_serverAddress: " << m_serverAddress.toStdString();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ struct AaroniaRTSASettings {
|
|||
};
|
||||
|
||||
quint64 m_centerFrequency;
|
||||
int m_sampleRate;
|
||||
QString m_serverAddress;
|
||||
|
||||
bool m_useReverseAPI;
|
||||
|
|
|
@ -134,13 +134,24 @@ void AaroniaRTSAWorker::getConfig()
|
|||
|
||||
void AaroniaRTSAWorker::onCenterFrequencyChanged(quint64 centerFrequency)
|
||||
{
|
||||
if (m_centerFrequency == centerFrequency)
|
||||
if (m_centerFrequency == centerFrequency) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_centerFrequency = centerFrequency;
|
||||
sendCenterFrequencyAndSampleRate();
|
||||
}
|
||||
|
||||
void AaroniaRTSAWorker::onSampleRateChanged(int sampleRate)
|
||||
{
|
||||
if (m_sampleRate == sampleRate) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_sampleRate = sampleRate;
|
||||
sendCenterFrequencyAndSampleRate();
|
||||
}
|
||||
|
||||
void AaroniaRTSAWorker::onServerAddressChanged(QString serverAddress)
|
||||
{
|
||||
m_status = AaroniaRTSASettings::ConnectionDisconnected;
|
||||
|
@ -274,28 +285,28 @@ void AaroniaRTSAWorker::onReadyRead()
|
|||
if (error.error == QJsonParseError::NoError)
|
||||
{
|
||||
// Extract fields of interest
|
||||
double startTime = jdoc["startTime"].toDouble(), endTime = jdoc["endTime"].toDouble();
|
||||
// double startTime = jdoc["startTime"].toDouble(), endTime = jdoc["endTime"].toDouble();
|
||||
int samples = jdoc["samples"].toInt();
|
||||
|
||||
// Dump packet loss
|
||||
if (startTime != mPrevTime)
|
||||
{
|
||||
qDebug() << "AaroniaRTSAWorker::onReadyRead: packet loss: "
|
||||
<< QDateTime::fromMSecsSinceEpoch(startTime * 1000).toString()
|
||||
<< " D " << endTime - startTime
|
||||
<< " O " << startTime - mPrevTime
|
||||
<< " S " << samples
|
||||
<< " L " << QDateTime::currentMSecsSinceEpoch() / 1000.0 - startTime;
|
||||
// if (startTime != mPrevTime)
|
||||
// {
|
||||
// qDebug() << "AaroniaRTSAWorker::onReadyRead: packet loss: "
|
||||
// << QDateTime::fromMSecsSinceEpoch(startTime * 1000).toString()
|
||||
// << " D " << endTime - startTime
|
||||
// << " O " << startTime - mPrevTime
|
||||
// << " S " << samples
|
||||
// << " L " << QDateTime::currentMSecsSinceEpoch() / 1000.0 - startTime;
|
||||
|
||||
if (m_status != AaroniaRTSASettings::ConnectionUnstable)
|
||||
{
|
||||
m_status = AaroniaRTSASettings::ConnectionUnstable;
|
||||
emit updateStatus(m_status);
|
||||
}
|
||||
}
|
||||
// if (m_status != AaroniaRTSASettings::ConnectionUnstable)
|
||||
// {
|
||||
// m_status = AaroniaRTSASettings::ConnectionUnstable;
|
||||
// emit updateStatus(m_status);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Switch to data phase
|
||||
mPrevTime = endTime;
|
||||
// mPrevTime = endTime;
|
||||
mPacketSamples = samples;
|
||||
// qDebug() << jdoc.toJson();
|
||||
quint64 endFreq = jdoc["endFrequency"].toDouble();
|
||||
|
|
|
@ -108,6 +108,7 @@ signals:
|
|||
|
||||
public slots:
|
||||
void onCenterFrequencyChanged(quint64 centerFrequency);
|
||||
void onSampleRateChanged(int sampleRate);
|
||||
void onServerAddressChanged(QString serverAddress);
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -2111,7 +2111,12 @@ margin-bottom: 20px;
|
|||
"properties" : {
|
||||
"centerFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
"format" : "int64",
|
||||
"description" : "Sets the center frequency (Hz) of the distant IQ demodulator"
|
||||
},
|
||||
"sampleRate" : {
|
||||
"type" : "integer",
|
||||
"description" : "Sets the sample rate (S/s) and span (Hz) of the distant IQ demodulator"
|
||||
},
|
||||
"serverAddress" : {
|
||||
"type" : "string",
|
||||
|
@ -57301,7 +57306,7 @@ except ApiException as e:
|
|||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2023-03-19T05:47:36.689+01:00
|
||||
Generated 2023-03-23T18:22:37.731+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,8 +2,12 @@ AaroniaRTSASettings:
|
|||
description: AaroniaRTSA
|
||||
properties:
|
||||
centerFrequency:
|
||||
description: Sets the center frequency (Hz) of the distant IQ demodulator
|
||||
type: integer
|
||||
format: int64
|
||||
sampleRate:
|
||||
description: Sets the sample rate (S/s) and span (Hz) of the distant IQ demodulator
|
||||
type: integer
|
||||
serverAddress:
|
||||
description: Distant AaroniaRTSA instance URL or IPv4 address with port
|
||||
type: string
|
||||
|
|
|
@ -2,8 +2,12 @@ AaroniaRTSASettings:
|
|||
description: AaroniaRTSA
|
||||
properties:
|
||||
centerFrequency:
|
||||
description: Sets the center frequency (Hz) of the distant IQ demodulator
|
||||
type: integer
|
||||
format: int64
|
||||
sampleRate:
|
||||
description: Sets the sample rate (S/s) and span (Hz) of the distant IQ demodulator
|
||||
type: integer
|
||||
serverAddress:
|
||||
description: Distant AaroniaRTSA instance URL or IPv4 address with port
|
||||
type: string
|
||||
|
|
|
@ -2111,7 +2111,12 @@ margin-bottom: 20px;
|
|||
"properties" : {
|
||||
"centerFrequency" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
"format" : "int64",
|
||||
"description" : "Sets the center frequency (Hz) of the distant IQ demodulator"
|
||||
},
|
||||
"sampleRate" : {
|
||||
"type" : "integer",
|
||||
"description" : "Sets the sample rate (S/s) and span (Hz) of the distant IQ demodulator"
|
||||
},
|
||||
"serverAddress" : {
|
||||
"type" : "string",
|
||||
|
@ -57301,7 +57306,7 @@ except ApiException as e:
|
|||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2023-03-19T05:47:36.689+01:00
|
||||
Generated 2023-03-23T18:22:37.731+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -30,6 +30,8 @@ SWGAaroniaRTSASettings::SWGAaroniaRTSASettings(QString* json) {
|
|||
SWGAaroniaRTSASettings::SWGAaroniaRTSASettings() {
|
||||
center_frequency = 0L;
|
||||
m_center_frequency_isSet = false;
|
||||
sample_rate = 0;
|
||||
m_sample_rate_isSet = false;
|
||||
server_address = nullptr;
|
||||
m_server_address_isSet = false;
|
||||
use_reverse_api = 0;
|
||||
|
@ -50,6 +52,8 @@ void
|
|||
SWGAaroniaRTSASettings::init() {
|
||||
center_frequency = 0L;
|
||||
m_center_frequency_isSet = false;
|
||||
sample_rate = 0;
|
||||
m_sample_rate_isSet = false;
|
||||
server_address = new QString("");
|
||||
m_server_address_isSet = false;
|
||||
use_reverse_api = 0;
|
||||
|
@ -65,6 +69,7 @@ SWGAaroniaRTSASettings::init() {
|
|||
void
|
||||
SWGAaroniaRTSASettings::cleanup() {
|
||||
|
||||
|
||||
if(server_address != nullptr) {
|
||||
delete server_address;
|
||||
}
|
||||
|
@ -89,6 +94,8 @@ void
|
|||
SWGAaroniaRTSASettings::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", "");
|
||||
|
||||
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&server_address, pJson["serverAddress"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
|
||||
|
@ -118,6 +125,9 @@ SWGAaroniaRTSASettings::asJsonObject() {
|
|||
if(m_center_frequency_isSet){
|
||||
obj->insert("centerFrequency", QJsonValue(center_frequency));
|
||||
}
|
||||
if(m_sample_rate_isSet){
|
||||
obj->insert("sampleRate", QJsonValue(sample_rate));
|
||||
}
|
||||
if(server_address != nullptr && *server_address != QString("")){
|
||||
toJsonValue(QString("serverAddress"), server_address, obj, QString("QString"));
|
||||
}
|
||||
|
@ -147,6 +157,16 @@ SWGAaroniaRTSASettings::setCenterFrequency(qint64 center_frequency) {
|
|||
this->m_center_frequency_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAaroniaRTSASettings::getSampleRate() {
|
||||
return sample_rate;
|
||||
}
|
||||
void
|
||||
SWGAaroniaRTSASettings::setSampleRate(qint32 sample_rate) {
|
||||
this->sample_rate = sample_rate;
|
||||
this->m_sample_rate_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGAaroniaRTSASettings::getServerAddress() {
|
||||
return server_address;
|
||||
|
@ -205,6 +225,9 @@ SWGAaroniaRTSASettings::isSet(){
|
|||
if(m_center_frequency_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_sample_rate_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(server_address && *server_address != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,9 @@ public:
|
|||
qint64 getCenterFrequency();
|
||||
void setCenterFrequency(qint64 center_frequency);
|
||||
|
||||
qint32 getSampleRate();
|
||||
void setSampleRate(qint32 sample_rate);
|
||||
|
||||
QString* getServerAddress();
|
||||
void setServerAddress(QString* server_address);
|
||||
|
||||
|
@ -67,6 +70,9 @@ private:
|
|||
qint64 center_frequency;
|
||||
bool m_center_frequency_isSet;
|
||||
|
||||
qint32 sample_rate;
|
||||
bool m_sample_rate_isSet;
|
||||
|
||||
QString* server_address;
|
||||
bool m_server_address_isSet;
|
||||
|
||||
|
|
Loading…
Reference in New Issue