mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-24 11:04:10 -04:00
SDRDaemonSource: adaptation to remote DaemonSink channel
This commit is contained in:
@@ -24,14 +24,10 @@
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <nn.h>
|
||||
#include <pair.h>
|
||||
#else
|
||||
#include <nanomsg/nn.h>
|
||||
#include <nanomsg/pair.h>
|
||||
#endif
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonParseError>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "ui_sdrdaemonsourcegui.h"
|
||||
#include "gui/colormapper.h"
|
||||
@@ -40,9 +36,9 @@
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "mainwindow.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
#include <device/devicesourceapi.h>
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
|
||||
#include "sdrdaemonsourcegui.h"
|
||||
|
||||
SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
@@ -80,12 +76,6 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceUISet *deviceUISet, QWidget* parent
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->centerFrequency->setValueRange(7, 0, 9999999U);
|
||||
|
||||
ui->freq->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->freq->setValueRange(7, 0, 9999999U);
|
||||
|
||||
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
|
||||
ui->sampleRate->setValueRange(7, 32000U, 9999999U);
|
||||
|
||||
displaySettings();
|
||||
|
||||
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
@@ -97,6 +87,9 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceUISet *deviceUISet, QWidget* parent
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
|
||||
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
|
||||
m_eventsTime.start();
|
||||
displayEventCounts();
|
||||
displayEventTimer();
|
||||
@@ -107,6 +100,8 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceUISet *deviceUISet, QWidget* parent
|
||||
|
||||
SDRdaemonSourceGui::~SDRdaemonSourceGui()
|
||||
{
|
||||
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
delete m_networkManager;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -149,7 +144,6 @@ bool SDRdaemonSourceGui::deserialize(const QByteArray& data)
|
||||
|
||||
if (m_settings.deserialize(data))
|
||||
{
|
||||
updateTxDelay();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
@@ -167,10 +161,8 @@ qint64 SDRdaemonSourceGui::getCenterFrequency() const
|
||||
return m_streamCenterFrequency;
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::setCenterFrequency(qint64 centerFrequency)
|
||||
void SDRdaemonSourceGui::setCenterFrequency(qint64 centerFrequency __attribute__((unused)))
|
||||
{
|
||||
m_settings.m_centerFrequency = centerFrequency;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
bool SDRdaemonSourceGui::handleMessage(const Message& message)
|
||||
@@ -220,10 +212,8 @@ bool SDRdaemonSourceGui::handleMessage(const Message& message)
|
||||
|
||||
int nbFECBlocks = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getNbFECBlocksPerFrame();
|
||||
|
||||
if (m_nbFECBlocks != nbFECBlocks)
|
||||
{
|
||||
if (m_nbFECBlocks != nbFECBlocks) {
|
||||
m_nbFECBlocks = nbFECBlocks;
|
||||
updateTxDelay();
|
||||
}
|
||||
|
||||
updateWithStreamTime();
|
||||
@@ -256,10 +246,8 @@ void SDRdaemonSourceGui::handleInputMessages()
|
||||
{
|
||||
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||
|
||||
if (notif->getSampleRate() != m_streamSampleRate)
|
||||
{
|
||||
if (notif->getSampleRate() != m_streamSampleRate) {
|
||||
m_streamSampleRate = notif->getSampleRate();
|
||||
updateTxDelay();
|
||||
}
|
||||
|
||||
m_streamCenterFrequency = notif->getCenterFrequency();
|
||||
@@ -289,21 +277,9 @@ void SDRdaemonSourceGui::updateSampleRateAndFrequency()
|
||||
ui->deviceRateText->setText(tr("%1k").arg((float)m_streamSampleRate / 1000));
|
||||
blockApplySettings(true);
|
||||
ui->centerFrequency->setValue(m_streamCenterFrequency / 1000);
|
||||
ui->freq->setValue(m_streamCenterFrequency / 1000);
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::updateTxDelay()
|
||||
{
|
||||
if (m_streamSampleRate == 0) {
|
||||
m_txDelay = 0.0; // 0 value will not set the Tx delay
|
||||
} else {
|
||||
m_txDelay = ((127*127*m_settings.m_txDelay) / m_streamSampleRate)/(128 + m_nbFECBlocks);
|
||||
}
|
||||
|
||||
ui->txDelayText->setToolTip(tr("%1 us").arg(QString::number(m_txDelay*1e6, 'f', 0)));
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::displaySettings()
|
||||
{
|
||||
blockApplySettings(true);
|
||||
@@ -311,24 +287,10 @@ void SDRdaemonSourceGui::displaySettings()
|
||||
ui->centerFrequency->setValue(m_streamCenterFrequency / 1000);
|
||||
ui->deviceRateText->setText(tr("%1k").arg(m_streamSampleRate / 1000.0));
|
||||
|
||||
ui->freq->setValue(m_streamCenterFrequency / 1000);
|
||||
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
||||
ui->fcPos->setCurrentIndex(m_settings.m_fcPos);
|
||||
ui->sampleRate->setValue(m_settings.m_sampleRate);
|
||||
ui->specificParms->setText(m_settings.m_specificParameters);
|
||||
ui->specificParms->setCursorPosition(0);
|
||||
ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay*100));
|
||||
ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks);
|
||||
QString nstr = QString("%1").arg(m_settings.m_nbFECBlocks, 2, 10, QChar('0'));
|
||||
ui->nbFECBlocksText->setText(nstr);
|
||||
|
||||
QString s0 = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0);
|
||||
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s0).arg(nstr));
|
||||
|
||||
ui->address->setText(m_settings.m_address);
|
||||
ui->apiAddress->setText(m_settings.m_apiAddress);
|
||||
ui->apiPort->setText(tr("%1").arg(m_settings.m_apiPort));
|
||||
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
|
||||
ui->controlPort->setText(tr("%1").arg(m_settings.m_controlPort));
|
||||
ui->specificParms->setText(m_settings.m_specificParameters);
|
||||
ui->dataAddress->setText(m_settings.m_dataAddress);
|
||||
|
||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
||||
@@ -342,45 +304,48 @@ void SDRdaemonSourceGui::sendSettings()
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_applyButton_clicked(bool checked __attribute__((unused)))
|
||||
void SDRdaemonSourceGui::on_apiApplyButton_clicked(bool checked __attribute__((unused)))
|
||||
{
|
||||
m_settings.m_address = ui->address->text();
|
||||
m_settings.m_apiAddress = ui->apiAddress->text();
|
||||
|
||||
bool send = false;
|
||||
bool ctlOk;
|
||||
int udpCtlPort = ui->controlPort->text().toInt(&ctlOk);
|
||||
int udpApiPort = ui->apiPort->text().toInt(&ctlOk);
|
||||
|
||||
if((ctlOk) && (udpCtlPort >= 1024) && (udpCtlPort < 65535))
|
||||
{
|
||||
m_settings.m_controlPort = udpCtlPort;
|
||||
send = true;
|
||||
if((ctlOk) && (udpApiPort >= 1024) && (udpApiPort < 65535)) {
|
||||
m_settings.m_apiPort = udpApiPort;
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_dataApplyButton_clicked(bool checked __attribute__((unused)))
|
||||
{
|
||||
m_settings.m_dataAddress = ui->dataAddress->text();
|
||||
|
||||
bool dataOk;
|
||||
int udpDataPort = ui->dataPort->text().toInt(&dataOk);
|
||||
|
||||
if((dataOk) && (udpDataPort >= 1024) && (udpDataPort < 65535))
|
||||
{
|
||||
if((dataOk) && (udpDataPort >= 1024) && (udpDataPort < 65535)) {
|
||||
m_settings.m_dataPort = udpDataPort;
|
||||
send = true;
|
||||
}
|
||||
|
||||
if (send) {
|
||||
sendSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_sendButton_clicked(bool checked __attribute__((unused)))
|
||||
{
|
||||
updateTxDelay();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
ui->specificParms->setCursorPosition(0);
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_address_returnPressed()
|
||||
void SDRdaemonSourceGui::on_apiAddress_returnPressed()
|
||||
{
|
||||
m_settings.m_address = ui->address->text();
|
||||
m_settings.m_apiAddress = ui->apiAddress->text();
|
||||
|
||||
QString infoURL = QString("http://%1:%2/sdrangel").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort);
|
||||
m_networkRequest.setUrl(QUrl(infoURL));
|
||||
m_networkManager->get(m_networkRequest);
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_dataAddress_returnPressed()
|
||||
{
|
||||
m_settings.m_dataAddress = ui->dataAddress->text();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@@ -400,18 +365,23 @@ void SDRdaemonSourceGui::on_dataPort_returnPressed()
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_controlPort_returnPressed()
|
||||
void SDRdaemonSourceGui::on_apiPort_returnPressed()
|
||||
{
|
||||
bool ctlOk;
|
||||
int udpCtlPort = ui->controlPort->text().toInt(&ctlOk);
|
||||
int udpApiPort = ui->apiPort->text().toInt(&ctlOk);
|
||||
|
||||
if((!ctlOk) || (udpCtlPort < 1024) || (udpCtlPort > 65535))
|
||||
if((!ctlOk) || (udpApiPort < 1024) || (udpApiPort > 65535))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.m_controlPort = udpCtlPort;
|
||||
m_settings.m_apiPort = udpApiPort;
|
||||
|
||||
QString infoURL = QString("http://%1:%2/sdrangel").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort);
|
||||
m_networkRequest.setUrl(QUrl(infoURL));
|
||||
m_networkManager->get(m_networkRequest);
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
}
|
||||
@@ -428,54 +398,6 @@ void SDRdaemonSourceGui::on_iqImbalance_toggled(bool checked)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_freq_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_sampleRate_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_sampleRate = value;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_specificParms_returnPressed()
|
||||
{
|
||||
if ((ui->specificParms->text()).size() > 0) {
|
||||
m_settings.m_specificParameters = ui->specificParms->text();
|
||||
sendSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_decim_currentIndexChanged(int index __attribute__((unused)))
|
||||
{
|
||||
m_settings.m_log2Decim = ui->decim->currentIndex();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_fcPos_currentIndexChanged(int index __attribute__((unused)))
|
||||
{
|
||||
m_settings.m_fcPos = ui->fcPos->currentIndex();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_txDelay_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_txDelay = value / 100.0;
|
||||
ui->txDelayText->setText(tr("%1").arg(value));
|
||||
updateTxDelay();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_nbFECBlocks_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_nbFECBlocks = value;
|
||||
QString nstr = QString("%1").arg(m_settings.m_nbFECBlocks, 2, 10, QChar('0'));
|
||||
ui->nbFECBlocksText->setText(nstr);
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::on_startStop_toggled(bool checked)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
@@ -631,3 +553,72 @@ void SDRdaemonSourceGui::updateStatus()
|
||||
ui->startStop->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::networkManagerFinished(QNetworkReply *reply)
|
||||
{
|
||||
if (reply->error())
|
||||
{
|
||||
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
ui->statusText->setText(reply->errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
QString answer = reply->readAll();
|
||||
|
||||
try
|
||||
{
|
||||
QByteArray jsonBytes(answer.toStdString().c_str());
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonBytes, &error);
|
||||
|
||||
if (error.error == QJsonParseError::NoError)
|
||||
{
|
||||
ui->apiAddressLabel->setStyleSheet("QLabel { background-color : green; }");
|
||||
ui->statusText->setText(QString("API OK"));
|
||||
analyzeApiReply(doc.object());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
QString errorMsg = QString("Reply JSON error: ") + error.errorString() + QString(" at offset ") + QString::number(error.offset);
|
||||
ui->statusText->setText(QString("JSON error. See log"));
|
||||
qInfo().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
ui->apiAddressLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
||||
QString errorMsg = QString("Error parsing request: ") + ex.what();
|
||||
ui->statusText->setText("Error parsing request. See log for details");
|
||||
qInfo().noquote() << "SDRdaemonSinkGui::networkManagerFinished" << errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSourceGui::analyzeApiReply(const QJsonObject& jsonObject)
|
||||
{
|
||||
QString infoLine;
|
||||
|
||||
if (jsonObject.contains("version")) {
|
||||
infoLine = "v" + jsonObject["version"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("qtVersion")) {
|
||||
infoLine += " Qt" + jsonObject["qtVersion"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("architecture")) {
|
||||
infoLine += " " + jsonObject["architecture"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("os")) {
|
||||
infoLine += " " + jsonObject["os"].toString();
|
||||
}
|
||||
|
||||
if (jsonObject.contains("dspRxBits") && jsonObject.contains("dspTxBits")) {
|
||||
infoLine += QString(" %1/%2b").arg(jsonObject["dspRxBits"].toInt()).arg(jsonObject["dspTxBits"].toInt());
|
||||
}
|
||||
|
||||
if (infoLine.size() > 0) {
|
||||
ui->infoText->setText(infoLine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,21 @@
|
||||
#ifndef INCLUDE_SDRDAEMONSOURCEGUI_H
|
||||
#define INCLUDE_SDRDAEMONSOURCEGUI_H
|
||||
|
||||
#include <plugin/plugininstancegui.h>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "plugin/plugininstancegui.h"
|
||||
#include "util/messagequeue.h"
|
||||
|
||||
#include "sdrdaemonsourceinput.h"
|
||||
|
||||
class DeviceUISet;
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class QJsonObject;
|
||||
|
||||
namespace Ui {
|
||||
class SDRdaemonSourceGui;
|
||||
@@ -98,38 +103,36 @@ private:
|
||||
QPalette m_paletteGreenText;
|
||||
QPalette m_paletteWhiteText;
|
||||
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void displaySettings();
|
||||
void displayTime();
|
||||
void sendSettings();
|
||||
void updateWithAcquisition();
|
||||
void updateWithStreamTime();
|
||||
void updateSampleRateAndFrequency();
|
||||
void updateTxDelay();
|
||||
void updateSampleRateAndFrequency();
|
||||
void displayEventCounts();
|
||||
void displayEventTimer();
|
||||
void analyzeApiReply(const QJsonObject& jsonObject);
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
void on_applyButton_clicked(bool checked);
|
||||
void on_apiApplyButton_clicked(bool checked);
|
||||
void on_dataApplyButton_clicked(bool checked);
|
||||
void on_dcOffset_toggled(bool checked);
|
||||
void on_iqImbalance_toggled(bool checked);
|
||||
void on_address_returnPressed();
|
||||
void on_apiAddress_returnPressed();
|
||||
void on_apiPort_returnPressed();
|
||||
void on_dataAddress_returnPressed();
|
||||
void on_dataPort_returnPressed();
|
||||
void on_controlPort_returnPressed();
|
||||
void on_sendButton_clicked(bool checked);
|
||||
void on_freq_changed(quint64 value);
|
||||
void on_sampleRate_changed(quint64 value);
|
||||
void on_specificParms_returnPressed();
|
||||
void on_decim_currentIndexChanged(int index);
|
||||
void on_fcPos_currentIndexChanged(int index);
|
||||
void on_startStop_toggled(bool checked);
|
||||
void on_record_toggled(bool checked);
|
||||
void on_eventCountsReset_clicked(bool checked);
|
||||
void on_txDelay_valueChanged(int value);
|
||||
void on_nbFECBlocks_valueChanged(int value);
|
||||
void updateHardware();
|
||||
void updateStatus();
|
||||
void networkManagerFinished(QNetworkReply *reply);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SDRDAEMONSOURCEGUI_H
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>372</width>
|
||||
<height>261</height>
|
||||
<width>360</width>
|
||||
<height>270</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>372</width>
|
||||
<height>261</height>
|
||||
<width>360</width>
|
||||
<height>270</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
@@ -373,41 +373,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="streamLayout">
|
||||
<item>
|
||||
<widget class="QDial" name="nbFECBlocks">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Desired number of FEC blocks per frame</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>64</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nbFECBlocksText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Desired number of FEC blocks per frame</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nominalNbBlocksText">
|
||||
<property name="minimumSize">
|
||||
@@ -577,28 +542,34 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="addressLayout">
|
||||
<layout class="QHBoxLayout" name="apiAddressLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="addressLabel">
|
||||
<widget class="QLabel" name="apiAddressLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Addr:</string>
|
||||
<string>API</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="address">
|
||||
<widget class="QLineEdit" name="apiAddress">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -617,52 +588,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="dataPortLabel">
|
||||
<widget class="QLabel" name="apiPortSeparator">
|
||||
<property name="text">
|
||||
<string>D:</string>
|
||||
<string>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dataPort">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Local data connection port</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="controlPortLabel">
|
||||
<property name="text">
|
||||
<string>C:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="controlPort">
|
||||
<widget class="QLineEdit" name="apiPort">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@@ -703,7 +636,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<widget class="QPushButton" name="apiApplyButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -721,54 +654,77 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_freq">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="frequencyLayout">
|
||||
<layout class="QHBoxLayout" name="dataAddressLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="freqLabel">
|
||||
<widget class="QLabel" name="dataAddressLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fc:</string>
|
||||
<string>Data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDial" name="freq" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QLineEdit" name="dataAddress">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0.0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="dataPortSeparator">
|
||||
<property name="text">
|
||||
<string>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dataPort">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Desired device center frequency</string>
|
||||
<string>Local data connection port</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="freqUnitLabel">
|
||||
<property name="text">
|
||||
<string>kHz</string>
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -786,256 +742,37 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="txDelayLabel">
|
||||
<property name="text">
|
||||
<string>UDly</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="txDelay">
|
||||
<widget class="QPushButton" name="dataApplyButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Delay between consecutive UDP packets in percentage of nominal UDP packet process time</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="txDelayText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>90</string>
|
||||
<string>Set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="sampleRateLayout">
|
||||
<layout class="QHBoxLayout" name="statusLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleRateLabel">
|
||||
<widget class="QLabel" name="statusText">
|
||||
<property name="text">
|
||||
<string>SR:</string>
|
||||
<string>...</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>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Desired remote device sample rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleRateUnits">
|
||||
<property name="text">
|
||||
<string>S/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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="decimLabel">
|
||||
<property name="text">
|
||||
<string>Dec:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="decim">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Decimation</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>16</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>32</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>64</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fcPosLabel">
|
||||
<property name="text">
|
||||
<string> Fp:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="fcPos">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Center frequency position (Infradyne, Supradyne, Centered)</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inf</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sup</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cen</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="controlLayout2">
|
||||
<layout class="QHBoxLayout" name="infoLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="specificParmsLAbel">
|
||||
<widget class="QLabel" name="infoText">
|
||||
<property name="text">
|
||||
<string>Sp:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="specificParms">
|
||||
<property name="toolTip">
|
||||
<string>Other parameters that are hardware specific</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sendButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Send commands to remote SDRdaemonRx instance</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -57,12 +57,6 @@ SDRdaemonSourceInput::SDRdaemonSourceInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceDescription(),
|
||||
m_startingTimeStamp(0)
|
||||
{
|
||||
m_sender = nn_socket(AF_SP, NN_PAIR);
|
||||
assert(m_sender != -1);
|
||||
int millis = 500;
|
||||
int rc __attribute__((unused)) = nn_setsockopt (m_sender, NN_SOL_SOCKET, NN_SNDTIMEO, &millis, sizeof (millis));
|
||||
assert (rc == 0);
|
||||
|
||||
m_sampleFifo.setSize(96000 * 4);
|
||||
m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, m_deviceAPI);
|
||||
|
||||
@@ -141,29 +135,16 @@ const QString& SDRdaemonSourceInput::getDeviceDescription() const
|
||||
|
||||
int SDRdaemonSourceInput::getSampleRate() const
|
||||
{
|
||||
if (m_SDRdaemonUDPHandler->getSampleRate()) {
|
||||
return m_SDRdaemonUDPHandler->getSampleRate();
|
||||
} else {
|
||||
return m_settings.m_sampleRate / (1<<m_settings.m_log2Decim);
|
||||
}
|
||||
return m_SDRdaemonUDPHandler->getSampleRate();
|
||||
}
|
||||
|
||||
quint64 SDRdaemonSourceInput::getCenterFrequency() const
|
||||
{
|
||||
if (m_SDRdaemonUDPHandler->getCenterFrequency()) {
|
||||
return m_SDRdaemonUDPHandler->getCenterFrequency();
|
||||
} else {
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
return m_SDRdaemonUDPHandler->getCenterFrequency();
|
||||
}
|
||||
|
||||
void SDRdaemonSourceInput::setCenterFrequency(qint64 centerFrequency)
|
||||
void SDRdaemonSourceInput::setCenterFrequency(qint64 centerFrequency __attribute__((unused)))
|
||||
{
|
||||
SDRdaemonSourceSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigureSDRdaemonSource* message = MsgConfigureSDRdaemonSource::create(m_settings, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
}
|
||||
|
||||
std::time_t SDRdaemonSourceInput::getStartingTimeStamp() const
|
||||
@@ -240,9 +221,7 @@ bool SDRdaemonSourceInput::handleMessage(const Message& message)
|
||||
void SDRdaemonSourceInput::applySettings(const SDRdaemonSourceSettings& settings, bool force)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
bool changeTxDelay = false;
|
||||
std::ostringstream os;
|
||||
int nbArgs = 0;
|
||||
QString remoteAddress;
|
||||
m_SDRdaemonUDPHandler->getRemoteAddress(remoteAddress);
|
||||
|
||||
@@ -250,139 +229,26 @@ void SDRdaemonSourceInput::applySettings(const SDRdaemonSourceSettings& settings
|
||||
{
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
|
||||
qDebug("SDRdaemonSourceInput::applySettings: corrections: DC block: %s IQ imbalance: %s",
|
||||
m_settings.m_dcBlock ? "true" : "false",
|
||||
m_settings.m_iqCorrection ? "true" : "false");
|
||||
settings.m_dcBlock ? "true" : "false",
|
||||
settings.m_iqCorrection ? "true" : "false");
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_address != settings.m_address) || (m_settings.m_dataPort != settings.m_dataPort))
|
||||
if (force || (m_settings.m_dataAddress != settings.m_dataAddress) || (m_settings.m_dataPort != settings.m_dataPort))
|
||||
{
|
||||
m_SDRdaemonUDPHandler->configureUDPLink(settings.m_address, settings.m_dataPort);
|
||||
m_SDRdaemonUDPHandler->configureUDPLink(settings.m_dataAddress, settings.m_dataPort);
|
||||
m_SDRdaemonUDPHandler->getRemoteAddress(remoteAddress);
|
||||
}
|
||||
|
||||
if (force || (remoteAddress != m_remoteAddress) || (m_settings.m_controlPort != settings.m_controlPort))
|
||||
{
|
||||
int rc = nn_shutdown(m_sender, 0);
|
||||
|
||||
if (rc < 0) {
|
||||
qDebug() << "SDRdaemonSourceInput::applySettings: nn disconnection failed";
|
||||
} else {
|
||||
qDebug() << "SDRdaemonSourceInput::applySettings: nn disconnection successful";
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
os << "tcp://" << remoteAddress.toStdString() << ":" << m_settings.m_controlPort;
|
||||
std::string addrstrng = os.str();
|
||||
rc = nn_connect(m_sender, addrstrng.c_str());
|
||||
|
||||
if (rc < 0) {
|
||||
qDebug() << "SDRdaemonSourceInput::applySettings: nn connexion to " << addrstrng.c_str() << " failed";
|
||||
} else {
|
||||
qDebug() << "SDRdaemonSourceInput::applySettings: nn connexion to " << addrstrng.c_str() << " successful";
|
||||
}
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency))
|
||||
{
|
||||
os << "freq=" << settings.m_centerFrequency;
|
||||
nbArgs++;
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_sampleRate != settings.m_sampleRate) || (m_settings.m_log2Decim != settings.m_log2Decim))
|
||||
{
|
||||
if (nbArgs > 0) os << ",";
|
||||
os << "srate=" << m_settings.m_sampleRate;
|
||||
nbArgs++;
|
||||
changeTxDelay = m_settings.m_sampleRate != settings.m_sampleRate;
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_log2Decim != settings.m_log2Decim))
|
||||
{
|
||||
if (nbArgs > 0) os << ",";
|
||||
os << "decim=" << settings.m_log2Decim;
|
||||
nbArgs++;
|
||||
}
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
{
|
||||
if (nbArgs > 0) os << ",";
|
||||
os << "fcpos=" << m_settings.m_fcPos;
|
||||
nbArgs++;
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_nbFECBlocks != settings.m_nbFECBlocks))
|
||||
{
|
||||
if (nbArgs > 0) os << ",";
|
||||
os << "fecblk=" << m_settings.m_nbFECBlocks;
|
||||
nbArgs++;
|
||||
changeTxDelay = true;
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_txDelay != settings.m_txDelay))
|
||||
{
|
||||
changeTxDelay = true;
|
||||
}
|
||||
|
||||
if (changeTxDelay)
|
||||
{
|
||||
double delay = ((127*127*settings.m_txDelay) / settings.m_sampleRate)/(128 + settings.m_nbFECBlocks);
|
||||
qDebug("SDRdaemonSourceInput::applySettings: Tx delay: %f us", delay*1e6);
|
||||
|
||||
if (delay != 0.0)
|
||||
{
|
||||
if (nbArgs > 0) os << ",";
|
||||
os << "txdelay=" << (int) (delay*1e6);
|
||||
nbArgs++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_specificParameters != settings.m_specificParameters) || force)
|
||||
{
|
||||
if (settings.m_specificParameters.size() > 0)
|
||||
{
|
||||
if (nbArgs > 0) os << ",";
|
||||
os << settings.m_specificParameters.toStdString();
|
||||
nbArgs++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbArgs > 0)
|
||||
{
|
||||
int config_size = os.str().size();
|
||||
int rc = nn_send(m_sender, (void *) os.str().c_str(), config_size, 0);
|
||||
|
||||
if (rc != config_size)
|
||||
{
|
||||
qDebug() << "SDRdaemonSourceInput::applySettings: Cannot nn send to "
|
||||
<< " remoteAddress: " << remoteAddress
|
||||
<< " remotePort: " << settings.m_controlPort
|
||||
<< " message: " << os.str().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "SDRdaemonSourceInput::applySettings: nn send to "
|
||||
<< "remoteAddress:" << remoteAddress
|
||||
<< "remotePort:" << settings.m_controlPort
|
||||
<< "message:" << os.str().c_str();
|
||||
}
|
||||
}
|
||||
|
||||
mutexLocker.unlock();
|
||||
m_settings = settings;
|
||||
m_remoteAddress = remoteAddress;
|
||||
|
||||
qDebug() << "SDRdaemonSourceInput::applySettings: "
|
||||
<< " m_address: " << m_settings.m_address
|
||||
<< " m_remoteAddress: " << m_remoteAddress
|
||||
<< " m_dataAddress: " << m_settings.m_dataAddress
|
||||
<< " m_dataPort: " << m_settings.m_dataPort
|
||||
<< " m_controlPort: " << m_settings.m_controlPort
|
||||
<< " m_centerFrequency: " << m_settings.m_centerFrequency
|
||||
<< " m_sampleRate: " << m_settings.m_sampleRate
|
||||
<< " m_log2Decim: " << m_settings.m_log2Decim
|
||||
<< " m_fcPos: " << m_settings.m_fcPos
|
||||
<< " m_txDelay: " << m_settings.m_txDelay
|
||||
<< " m_nbFECBlocks: " << m_settings.m_nbFECBlocks
|
||||
<< " m_specificParameters: " << m_settings.m_specificParameters;
|
||||
<< " m_apiAddress: " << m_settings.m_apiAddress
|
||||
<< " m_apiPort: " << m_settings.m_apiPort
|
||||
<< " m_remoteAddress: " << m_remoteAddress;
|
||||
}
|
||||
|
||||
int SDRdaemonSourceInput::webapiRunGet(
|
||||
@@ -429,43 +295,24 @@ int SDRdaemonSourceInput::webapiSettingsPutPatch(
|
||||
{
|
||||
SDRdaemonSourceSettings settings = m_settings;
|
||||
|
||||
if (deviceSettingsKeys.contains("centerFrequency")) {
|
||||
settings.m_centerFrequency = response.getSdrDaemonSourceSettings()->getCenterFrequency();
|
||||
if (deviceSettingsKeys.contains("apiAddress")) {
|
||||
settings.m_apiAddress = *response.getSdrDaemonSourceSettings()->getApiAddress();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("sampleRate")) {
|
||||
settings.m_sampleRate = response.getSdrDaemonSourceSettings()->getSampleRate();
|
||||
if (deviceSettingsKeys.contains("apiPort")) {
|
||||
settings.m_apiPort = response.getSdrDaemonSourceSettings()->getApiPort();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("log2Decim")) {
|
||||
settings.m_log2Decim = response.getSdrDaemonSourceSettings()->getLog2Decim();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("txDelay")) {
|
||||
settings.m_txDelay = response.getSdrDaemonSourceSettings()->getTxDelay();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("nbFECBlocks")) {
|
||||
settings.m_txDelay = response.getSdrDaemonSourceSettings()->getNbFecBlocks();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("address")) {
|
||||
settings.m_address = *response.getSdrDaemonSourceSettings()->getAddress();
|
||||
if (deviceSettingsKeys.contains("dataAddress")) {
|
||||
settings.m_dataAddress = *response.getSdrDaemonSourceSettings()->getDataAddress();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("dataPort")) {
|
||||
settings.m_dataPort = response.getSdrDaemonSourceSettings()->getDataPort();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("controlPort")) {
|
||||
settings.m_controlPort = response.getSdrDaemonSourceSettings()->getControlPort();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("specificParameters")) {
|
||||
settings.m_specificParameters = *response.getSdrDaemonSourceSettings()->getSpecificParameters();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("dcBlock")) {
|
||||
settings.m_dcBlock = response.getSdrDaemonSourceSettings()->getDcBlock() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("iqCorrection")) {
|
||||
settings.m_iqCorrection = response.getSdrDaemonSourceSettings()->getIqCorrection() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("fcPos")) {
|
||||
int fcPos = response.getSdrDaemonSourceSettings()->getFcPos();
|
||||
settings.m_fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("fileRecordName")) {
|
||||
settings.m_fileRecordName = *response.getSdrDaemonSourceSettings()->getFileRecordName();
|
||||
}
|
||||
@@ -485,18 +332,12 @@ int SDRdaemonSourceInput::webapiSettingsPutPatch(
|
||||
|
||||
void SDRdaemonSourceInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SDRdaemonSourceSettings& settings)
|
||||
{
|
||||
response.getSdrDaemonSourceSettings()->setCenterFrequency(settings.m_centerFrequency);
|
||||
response.getSdrDaemonSourceSettings()->setSampleRate(settings.m_sampleRate);
|
||||
response.getSdrDaemonSourceSettings()->setLog2Decim(settings.m_log2Decim);
|
||||
response.getSdrDaemonSourceSettings()->setTxDelay(settings.m_txDelay);
|
||||
response.getSdrDaemonSourceSettings()->setNbFecBlocks(settings.m_nbFECBlocks);
|
||||
response.getSdrDaemonSourceSettings()->setAddress(new QString(settings.m_address));
|
||||
response.getSdrDaemonSourceSettings()->setApiAddress(new QString(settings.m_apiAddress));
|
||||
response.getSdrDaemonSourceSettings()->setApiPort(settings.m_apiPort);
|
||||
response.getSdrDaemonSourceSettings()->setDataAddress(new QString(settings.m_dataAddress));
|
||||
response.getSdrDaemonSourceSettings()->setDataPort(settings.m_dataPort);
|
||||
response.getSdrDaemonSourceSettings()->setControlPort(settings.m_controlPort);
|
||||
response.getSdrDaemonSourceSettings()->setSpecificParameters(new QString(settings.m_specificParameters));
|
||||
response.getSdrDaemonSourceSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
|
||||
response.getSdrDaemonSourceSettings()->setIqCorrection(settings.m_iqCorrection);
|
||||
response.getSdrDaemonSourceSettings()->setFcPos((int) settings.m_fcPos);
|
||||
|
||||
if (response.getSdrDaemonSourceSettings()->getFileRecordName()) {
|
||||
*response.getSdrDaemonSourceSettings()->getFileRecordName() = settings.m_fileRecordName;
|
||||
|
||||
@@ -308,7 +308,6 @@ private:
|
||||
SDRdaemonSourceSettings m_settings;
|
||||
SDRdaemonSourceUDPHandler* m_SDRdaemonUDPHandler;
|
||||
QString m_remoteAddress;
|
||||
int m_sender;
|
||||
QString m_deviceDescription;
|
||||
std::time_t m_startingTimeStamp;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
|
||||
@@ -24,18 +24,12 @@ SDRdaemonSourceSettings::SDRdaemonSourceSettings()
|
||||
|
||||
void SDRdaemonSourceSettings::resetToDefaults()
|
||||
{
|
||||
m_centerFrequency = 435000*1000;
|
||||
m_sampleRate = 256000;
|
||||
m_log2Decim = 1;
|
||||
m_txDelay = 0.5;
|
||||
m_nbFECBlocks = 0;
|
||||
m_address = "127.0.0.1";
|
||||
m_dataPort = 9092;
|
||||
m_controlPort = 9093;
|
||||
m_specificParameters = "";
|
||||
m_apiAddress = "127.0.0.1";
|
||||
m_apiPort = 9091;
|
||||
m_dataAddress = "127.0.0.1";
|
||||
m_dataPort = 9090;
|
||||
m_dcBlock = false;
|
||||
m_iqCorrection = false;
|
||||
m_fcPos = 2; // center
|
||||
m_fileRecordName = "";
|
||||
}
|
||||
|
||||
@@ -43,17 +37,12 @@ QByteArray SDRdaemonSourceSettings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeU64(1, m_sampleRate);
|
||||
s.writeU32(2, m_log2Decim);
|
||||
s.writeFloat(3, m_txDelay);
|
||||
s.writeU32(4, m_nbFECBlocks);
|
||||
s.writeString(5, m_address);
|
||||
s.writeString(5, m_apiAddress);
|
||||
s.writeU32(6, m_dataPort);
|
||||
s.writeU32(7, m_controlPort);
|
||||
s.writeString(8, m_specificParameters);
|
||||
s.writeU32(7, m_apiPort);
|
||||
s.writeString(8, m_dataAddress);
|
||||
s.writeBool(9, m_dcBlock);
|
||||
s.writeBool(10, m_iqCorrection);
|
||||
s.writeU32(11, m_fcPos);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@@ -71,19 +60,14 @@ bool SDRdaemonSourceSettings::deserialize(const QByteArray& data)
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
quint32 uintval;
|
||||
d.readU64(1, &m_sampleRate, 48000);
|
||||
d.readU32(2, &m_log2Decim, 0);
|
||||
d.readFloat(3, &m_txDelay, 0.5);
|
||||
d.readU32(4, &m_nbFECBlocks, 0);
|
||||
d.readString(5, &m_address, "127.0.0.1");
|
||||
d.readString(5, &m_apiAddress, "127.0.0.1");
|
||||
d.readU32(6, &uintval, 9090);
|
||||
m_dataPort = uintval % (1<<16);
|
||||
d.readU32(7, &uintval, 9090);
|
||||
m_controlPort = uintval % (1<<16);
|
||||
d.readString(8, &m_specificParameters, "");
|
||||
d.readU32(7, &uintval, 9091);
|
||||
m_dataPort = uintval % (1<<16);
|
||||
d.readString(8, &m_dataAddress, "127.0.0.1");
|
||||
d.readBool(9, &m_dcBlock, false);
|
||||
d.readBool(10, &m_iqCorrection, false);
|
||||
d.readU32(11, &m_fcPos, 2);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,18 +21,12 @@
|
||||
#include <QString>
|
||||
|
||||
struct SDRdaemonSourceSettings {
|
||||
quint64 m_centerFrequency;
|
||||
quint64 m_sampleRate;
|
||||
quint32 m_log2Decim;
|
||||
float m_txDelay;
|
||||
quint32 m_nbFECBlocks;
|
||||
QString m_address;
|
||||
QString m_apiAddress;
|
||||
quint16 m_apiPort;
|
||||
QString m_dataAddress;
|
||||
quint16 m_dataPort;
|
||||
quint16 m_controlPort;
|
||||
QString m_specificParameters;
|
||||
bool m_dcBlock;
|
||||
bool m_iqCorrection;
|
||||
quint32 m_fcPos;
|
||||
QString m_fileRecordName;
|
||||
|
||||
SDRdaemonSourceSettings();
|
||||
|
||||
Reference in New Issue
Block a user