1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Aaronia RSA Rx: cleanup old code

This commit is contained in:
f4exb 2023-03-19 10:49:18 +01:00
parent a814b1f2bf
commit 9e75ccb699
16 changed files with 4 additions and 401 deletions

View File

@ -159,38 +159,12 @@ void AaroniaRTSAGui::on_serverAddressApplyButton_clicked()
sendSettings();
}
void AaroniaRTSAGui::on_dcBlock_toggled(bool checked)
{
m_settings.m_dcBlock = checked;
m_settingsKeys.append("dcBlock");
sendSettings();
}
void AaroniaRTSAGui::on_agc_toggled(bool checked)
{
m_settings.m_useAGC = checked;
m_settingsKeys.append("useAGC");
sendSettings();
}
void AaroniaRTSAGui::on_gain_valueChanged(int value)
{
m_settings.m_gain = value;
ui->gainText->setText(QString::number(m_settings.m_gain) + " dB");
m_settingsKeys.append("gain");
sendSettings();
}
void AaroniaRTSAGui::displaySettings()
{
blockApplySettings(true);
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->serverAddress->setText(m_settings.m_serverAddress);
ui->gain->setValue(m_settings.m_gain);
ui->gainText->setText(QString::number(m_settings.m_gain) + " dB");
ui->agc->setChecked(m_settings.m_useAGC);
ui->dcBlock->setChecked(m_settings.m_dcBlock);
blockApplySettings(false);
}
@ -353,9 +327,6 @@ 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->gain, &QSlider::valueChanged, this, &AaroniaRTSAGui::on_gain_valueChanged);
QObject::connect(ui->agc, &QToolButton::toggled, this, &AaroniaRTSAGui::on_agc_toggled);
QObject::connect(ui->serverAddress, &QLineEdit::returnPressed, this, &AaroniaRTSAGui::on_serverAddress_returnPressed);
QObject::connect(ui->serverAddressApplyButton, &QPushButton::clicked, this, &AaroniaRTSAGui::on_serverAddressApplyButton_clicked);
QObject::connect(ui->dcBlock, &ButtonSwitch::toggled, this, &AaroniaRTSAGui::on_dcBlock_toggled);
}

View File

@ -76,11 +76,8 @@ private slots:
void handleInputMessages();
void on_startStop_toggled(bool checked);
void on_centerFrequency_changed(quint64 value);
void on_gain_valueChanged(int value);
void on_agc_toggled(bool checked);
void on_serverAddress_returnPressed();
void on_serverAddressApplyButton_clicked();
void on_dcBlock_toggled(bool checked);
void openDeviceSettingsDialog(const QPoint& p);
void updateStatus();
void updateHardware();

View File

@ -239,81 +239,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="gainLayout">
<item>
<widget class="QLabel" name="gainLabel">
<property name="text">
<string>Gain</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="gain">
<property name="toolTip">
<string>Manual gain</string>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gainText">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>20 dB</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="agc">
<property name="toolTip">
<string>Automatic gain control</string>
</property>
<property name="text">
<string>AGC</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="dcBlock">
<property name="toolTip">
<string>Automatic DC offset removal</string>
</property>
<property name="text">
<string>DC</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -110,7 +110,6 @@ bool AaroniaRTSAInput::start()
connect(this, &AaroniaRTSAInput::setWorkerCenterFrequency, m_aaroniaRTSAWorker, &AaroniaRTSAWorker::onCenterFrequencyChanged);
connect(this, &AaroniaRTSAInput::setWorkerServerAddress, m_aaroniaRTSAWorker, &AaroniaRTSAWorker::onServerAddressChanged);
connect(this, &AaroniaRTSAInput::setWorkerGain, m_aaroniaRTSAWorker, &AaroniaRTSAWorker::onGainChanged);
connect(m_aaroniaRTSAWorker, &AaroniaRTSAWorker::updateStatus, this, &AaroniaRTSAInput::setWorkerStatus);
m_aaroniaRTSAWorkerThread->start();
@ -283,16 +282,6 @@ bool AaroniaRTSAInput::applySettings(const AaroniaRTSASettings& settings, const
emit setWorkerServerAddress(settings.m_serverAddress);
}
if (settingsKeys.contains("gain") ||
settingsKeys.contains("useAGC") || force)
{
emit setWorkerGain(settings.m_gain, settings.m_useAGC);
}
if (settingsKeys.contains("dcBlock")) {
m_deviceAPI->configureCorrections(settings.m_dcBlock, false);
}
if (settingsKeys.contains("centerFrequency") || force)
{
emit setWorkerCenterFrequency(settings.m_centerFrequency);
@ -387,15 +376,6 @@ void AaroniaRTSAInput::webapiUpdateDeviceSettings(
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response)
{
if (deviceSettingsKeys.contains("gain")) {
settings.m_gain = response.getAaroniaRtsaSettings()->getGain();
}
if (deviceSettingsKeys.contains("useAGC")) {
settings.m_useAGC = response.getAaroniaRtsaSettings()->getUseAgc();
}
if (deviceSettingsKeys.contains("dcBlock")) {
settings.m_dcBlock = response.getAaroniaRtsaSettings()->getDcBlock() != 0;
}
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getAaroniaRtsaSettings()->getCenterFrequency();
}
@ -429,9 +409,6 @@ int AaroniaRTSAInput::webapiReportGet(
void AaroniaRTSAInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AaroniaRTSASettings& settings)
{
response.getAaroniaRtsaSettings()->setGain(settings.m_gain);
response.getAaroniaRtsaSettings()->setUseAgc(settings.m_useAGC ? 1 : 0);
response.getAaroniaRtsaSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
response.getAaroniaRtsaSettings()->setCenterFrequency(settings.m_centerFrequency);
if (response.getAaroniaRtsaSettings()->getServerAddress()) {
@ -468,15 +445,6 @@ void AaroniaRTSAInput::webapiReverseSendSettings(const QList<QString>& deviceSet
// transfer data that has been modified. When force is on transfer all data except reverse API data
if (deviceSettingsKeys.contains("gain")) {
swgAaroniaRTSASettings->setGain(settings.m_gain);
}
if (deviceSettingsKeys.contains("useAGC")) {
swgAaroniaRTSASettings->setUseAgc(settings.m_useAGC ? 1 : 0);
}
if (deviceSettingsKeys.contains("dcBlock") || force) {
swgAaroniaRTSASettings->setDcBlock(settings.m_dcBlock ? 1 : 0);
}
if (deviceSettingsKeys.contains("centerFrequency") || force) {
swgAaroniaRTSASettings->setCenterFrequency(settings.m_centerFrequency);
}

View File

@ -176,7 +176,6 @@ signals:
void stopWorker();
void setWorkerCenterFrequency(quint64 centerFrequency);
void setWorkerServerAddress(QString serverAddress);
void setWorkerGain(quint32 gain, bool useAGC);
private slots:
void setWorkerStatus(int status);

View File

@ -27,13 +27,7 @@ AaroniaRTSASettings::AaroniaRTSASettings()
void AaroniaRTSASettings::resetToDefaults()
{
m_centerFrequency = 1450000;
m_gain = 20;
m_useAGC = true;
m_dcBlock = false;
m_serverAddress = "127.0.0.1:8073";
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
@ -45,9 +39,6 @@ QByteArray AaroniaRTSASettings::serialize() const
SimpleSerializer s(2);
s.writeString(2, m_serverAddress);
s.writeU32(3, m_gain);
s.writeBool(4, m_useAGC);
s.writeBool(100, m_useReverseAPI);
s.writeString(101, m_reverseAPIAddress);
s.writeU32(102, m_reverseAPIPort);
@ -71,9 +62,6 @@ bool AaroniaRTSASettings::deserialize(const QByteArray& data)
uint32_t utmp;
d.readString(2, &m_serverAddress, "127.0.0.1:8073");
d.readU32(3, &m_gain, 20);
d.readBool(4, &m_useAGC, true);
d.readBool(100, &m_useReverseAPI, false);
d.readString(101, &m_reverseAPIAddress, "127.0.0.1");
d.readU32(102, &utmp, 0);
@ -102,15 +90,6 @@ void AaroniaRTSASettings::applySettings(const QStringList& settingsKeys, const A
if (settingsKeys.contains("centerFrequency")) {
m_centerFrequency = settings.m_centerFrequency;
}
if (settingsKeys.contains("gain")) {
m_gain = settings.m_gain;
}
if (settingsKeys.contains("useAGC")) {
m_useAGC = settings.m_useAGC;
}
if (settingsKeys.contains("dcBlock")) {
m_dcBlock = settings.m_dcBlock;
}
if (settingsKeys.contains("serverAddress")) {
m_serverAddress = settings.m_serverAddress;
}
@ -135,15 +114,6 @@ QString AaroniaRTSASettings::getDebugString(const QStringList& settingsKeys, boo
if (settingsKeys.contains("centerFrequency") || force) {
ostr << " m_centerFrequency: " << m_centerFrequency;
}
if (settingsKeys.contains("gain") || force) {
ostr << " m_gain: " << m_gain;
}
if (settingsKeys.contains("useAGC") || force) {
ostr << " m_useAGC: " << m_useAGC;
}
if (settingsKeys.contains("dcBlock") || force) {
ostr << " m_dcBlock: " << m_dcBlock;
}
if (settingsKeys.contains("serverAddress") || force) {
ostr << " m_serverAddress: " << m_serverAddress.toStdString();
}

View File

@ -23,9 +23,6 @@
#include <QByteArray>
struct AaroniaRTSASettings {
uint32_t m_gain;
bool m_useAGC;
bool m_dcBlock;
quint64 m_centerFrequency;
QString m_serverAddress;

View File

@ -69,18 +69,6 @@ AaroniaRTSAWorker::AaroniaRTSAWorker(SampleSinkFifo* sampleFifo) :
}
void AaroniaRTSAWorker::onConnected()
{
m_webSocket.sendTextMessage("SET auth t=rtsa p=#");
}
void AaroniaRTSAWorker::onDisconnected()
{
qDebug("AaroniaRTSAWorker::onDisconnected");
m_status = 4;
emit updateStatus(4);
}
void AaroniaRTSAWorker::onSocketError(QAbstractSocket::SocketError error)
{
(void) error;
@ -101,73 +89,6 @@ void AaroniaRTSAWorker::sendCenterFrequency()
}
void AaroniaRTSAWorker::sendGain()
{
if (!m_webSocket.isValid())
return;
QString msg("SET agc=");
msg.append(m_useAGC ? "1" : "0");
msg.append(" hang=0 thresh=-130 slope=6 decay=1000 manGain=");
msg.append(QString::number(m_gain));
m_webSocket.sendTextMessage(msg);
}
void AaroniaRTSAWorker::onBinaryMessageReceived(const QByteArray &message)
{
if (message[0] == 'M' && message[1] == 'S' && message[2] == 'G')
{
QStringList al = QString::fromUtf8(message).split(' ');
if ((al.size() > 2) && al[2].startsWith("audio_rate="))
{
QStringList rateKeyVal = al[2].split('=');
if (rateKeyVal.size() > 1)
{
bool ok;
int sampleRate = rateKeyVal[1].toInt(&ok);
if (ok) {
m_sampleRate = sampleRate;
}
qDebug("AaroniaRTSAWorker::onBinaryMessageReceived: sample rate: %d", m_sampleRate);
if (m_inputMessageQueue) {
m_inputMessageQueue->push(MsgReportSampleRate::create(m_sampleRate));
}
QString msg = QString("SET AR OK in=%1 out=48000").arg(m_sampleRate);
m_webSocket.sendTextMessage(msg);
m_webSocket.sendTextMessage("SERVER DE CLIENT RtsaAngel SND");
sendGain();
sendCenterFrequency();
m_timer.start(5000);
m_status = 2;
emit updateStatus(2);
}
}
}
else if (message[0] == 'S' && message[1] == 'N' && message[2] == 'D')
{
int dataOffset = 20;
int sampleCount = 512;
const int16_t* messageSamples = (const int16_t*)(message.constData() + dataOffset);
m_samplesBuf.clear();
for (int i = 0; i < sampleCount; i++)
{
m_samplesBuf.push_back(Sample(
boost::endian::endian_reverse(messageSamples[i * 2]) << (SDR_RX_SAMP_SZ - 16),
boost::endian::endian_reverse(messageSamples[i * 2 + 1]) << (SDR_RX_SAMP_SZ - 16)
));
}
m_sampleFifo->write(m_samplesBuf.begin(), m_samplesBuf.end());
}
}
void AaroniaRTSAWorker::onCenterFrequencyChanged(quint64 centerFrequency)
{
if (m_centerFrequency == centerFrequency)
@ -177,17 +98,6 @@ void AaroniaRTSAWorker::onCenterFrequencyChanged(quint64 centerFrequency)
sendCenterFrequency();
}
void AaroniaRTSAWorker::onGainChanged(quint32 gain, bool useAGC)
{
if (m_gain == gain && m_useAGC == useAGC)
return;
m_gain = gain;
m_useAGC = useAGC;
sendGain();
}
void AaroniaRTSAWorker::onServerAddressChanged(QString serverAddress)
{
/*if (m_serverAddress == serverAddress) {
@ -209,12 +119,8 @@ void AaroniaRTSAWorker::onServerAddressChanged(QString serverAddress)
void AaroniaRTSAWorker::tick()
{
//m_webSocket.sendTextMessage("SET keepalive");
}
/**************************CPY ********************************* */
void AaroniaRTSAWorker::onError(QNetworkReply::NetworkError code)
@ -250,7 +156,7 @@ void AaroniaRTSAWorker::onReadyRead()
int offset = 0;
int avail = mBuffer.size();
// cosume all input data if possible
// consume all input data if possible
while (offset < avail)
{
// any samples so far (not looking for meta data)

View File

@ -19,7 +19,6 @@
#define _AARONIARTSA_AARONIARTSAWORKER_H_
#include <QTimer>
#include <QtWebSockets/QtWebSockets>
#include "dsp/samplesinkfifo.h"
#include "util/message.h"
@ -66,7 +65,6 @@ public:
private:
QTimer m_timer;
QWebSocket m_webSocket;
SampleVector m_samplesBuf;
SampleSinkFifo* m_sampleFifo;
@ -82,7 +80,6 @@ private:
int m_status; //!< See GUI for status number detail
void sendCenterFrequency();
void sendGain();
// QT htttp client
@ -113,20 +110,13 @@ signals:
public slots:
void onCenterFrequencyChanged(quint64 centerFrequency);
void onServerAddressChanged(QString serverAddress);
void onGainChanged(quint32 gain, bool useAGC);
private slots:
void onConnected();
void onDisconnected();
void onBinaryMessageReceived(const QByteArray &message);
void onSocketError(QAbstractSocket::SocketError error);
void onError(QNetworkReply::NetworkError code);
void onFinished(void);
void onReadyRead(void);
void tick();
};

View File

@ -2,6 +2,7 @@
<qresource prefix="/">
<file>webapi/doc/html2/index.html</file>
<file>webapi/doc/swagger/swagger.yaml</file>
<file>webapi/doc/swagger/include/AaroniaRTSA.yaml</file>
<file>webapi/doc/swagger/include/ADSBDemod.yaml</file>
<file>webapi/doc/swagger/include/AFC.yaml</file>
<file>webapi/doc/swagger/include/Airspy.yaml</file>

View File

@ -2109,16 +2109,6 @@ margin-bottom: 20px;
};
defs.AaroniaRTSASettings = {
"properties" : {
"gain" : {
"type" : "integer"
},
"useAGC" : {
"type" : "integer",
"description" : "AGC active (1 for yes, 0 for no)"
},
"dcBlock" : {
"type" : "integer"
},
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
@ -57311,7 +57301,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2023-03-11T14:00:49.111+01:00
Generated 2023-03-19T05:47:36.689+01:00
</div>
</div>
</div>

View File

@ -1,13 +1,6 @@
AaroniaRTSASettings:
description: AaroniaRTSA
properties:
gain:
type: integer
useAGC:
description: AGC active (1 for yes, 0 for no)
type: integer
dcBlock:
type: integer
centerFrequency:
type: integer
format: int64

View File

@ -1,13 +1,6 @@
AaroniaRTSASettings:
description: AaroniaRTSA
properties:
gain:
type: integer
useAGC:
description: AGC active (1 for yes, 0 for no)
type: integer
dcBlock:
type: integer
centerFrequency:
type: integer
format: int64

View File

@ -2109,16 +2109,6 @@ margin-bottom: 20px;
};
defs.AaroniaRTSASettings = {
"properties" : {
"gain" : {
"type" : "integer"
},
"useAGC" : {
"type" : "integer",
"description" : "AGC active (1 for yes, 0 for no)"
},
"dcBlock" : {
"type" : "integer"
},
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
@ -57311,7 +57301,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2023-03-11T14:00:49.111+01:00
Generated 2023-03-19T05:47:36.689+01:00
</div>
</div>
</div>

View File

@ -28,12 +28,6 @@ SWGAaroniaRTSASettings::SWGAaroniaRTSASettings(QString* json) {
}
SWGAaroniaRTSASettings::SWGAaroniaRTSASettings() {
gain = 0;
m_gain_isSet = false;
use_agc = 0;
m_use_agc_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
center_frequency = 0L;
m_center_frequency_isSet = false;
server_address = nullptr;
@ -54,12 +48,6 @@ SWGAaroniaRTSASettings::~SWGAaroniaRTSASettings() {
void
SWGAaroniaRTSASettings::init() {
gain = 0;
m_gain_isSet = false;
use_agc = 0;
m_use_agc_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
center_frequency = 0L;
m_center_frequency_isSet = false;
server_address = new QString("");
@ -77,9 +65,6 @@ SWGAaroniaRTSASettings::init() {
void
SWGAaroniaRTSASettings::cleanup() {
if(server_address != nullptr) {
delete server_address;
}
@ -102,12 +87,6 @@ SWGAaroniaRTSASettings::fromJson(QString &json) {
void
SWGAaroniaRTSASettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
::SWGSDRangel::setValue(&use_agc, pJson["useAGC"], "qint32", "");
::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&server_address, pJson["serverAddress"], "QString", "QString");
@ -136,15 +115,6 @@ SWGAaroniaRTSASettings::asJson ()
QJsonObject*
SWGAaroniaRTSASettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_gain_isSet){
obj->insert("gain", QJsonValue(gain));
}
if(m_use_agc_isSet){
obj->insert("useAGC", QJsonValue(use_agc));
}
if(m_dc_block_isSet){
obj->insert("dcBlock", QJsonValue(dc_block));
}
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency));
}
@ -167,36 +137,6 @@ SWGAaroniaRTSASettings::asJsonObject() {
return obj;
}
qint32
SWGAaroniaRTSASettings::getGain() {
return gain;
}
void
SWGAaroniaRTSASettings::setGain(qint32 gain) {
this->gain = gain;
this->m_gain_isSet = true;
}
qint32
SWGAaroniaRTSASettings::getUseAgc() {
return use_agc;
}
void
SWGAaroniaRTSASettings::setUseAgc(qint32 use_agc) {
this->use_agc = use_agc;
this->m_use_agc_isSet = true;
}
qint32
SWGAaroniaRTSASettings::getDcBlock() {
return dc_block;
}
void
SWGAaroniaRTSASettings::setDcBlock(qint32 dc_block) {
this->dc_block = dc_block;
this->m_dc_block_isSet = true;
}
qint64
SWGAaroniaRTSASettings::getCenterFrequency() {
return center_frequency;
@ -262,15 +202,6 @@ bool
SWGAaroniaRTSASettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_gain_isSet){
isObjectUpdated = true; break;
}
if(m_use_agc_isSet){
isObjectUpdated = true; break;
}
if(m_dc_block_isSet){
isObjectUpdated = true; break;
}
if(m_center_frequency_isSet){
isObjectUpdated = true; break;
}

View File

@ -42,15 +42,6 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGAaroniaRTSASettings* fromJson(QString &jsonString) override;
qint32 getGain();
void setGain(qint32 gain);
qint32 getUseAgc();
void setUseAgc(qint32 use_agc);
qint32 getDcBlock();
void setDcBlock(qint32 dc_block);
qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency);
@ -73,15 +64,6 @@ public:
virtual bool isSet() override;
private:
qint32 gain;
bool m_gain_isSet;
qint32 use_agc;
bool m_use_agc_isSet;
qint32 dc_block;
bool m_dc_block_isSet;
qint64 center_frequency;
bool m_center_frequency_isSet;