mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-02 13:17:48 -04:00
SDRDaemonSink: refactored rate control and removed server type from GUI and REST API
This commit is contained in:
parent
6f3bb72d52
commit
4a06cc94a0
@ -245,7 +245,6 @@ void SDRdaemonSinkGui::displaySettings()
|
||||
QString s1 = QString::number(m_settings.m_nbFECBlocks, 'f', 0);
|
||||
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s0).arg(s1));
|
||||
|
||||
ui->serverType->setCurrentIndex((int) m_settings.m_serverType);
|
||||
ui->deviceIndex->setText(tr("%1").arg(m_settings.m_deviceIndex));
|
||||
ui->channelIndex->setText(tr("%1").arg(m_settings.m_channelIndex));
|
||||
ui->apiAddress->setText(m_settings.m_apiAddress);
|
||||
@ -333,17 +332,6 @@ void SDRdaemonSinkGui::on_nbFECBlocks_valueChanged(int value)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::on_serverType_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_serverType = (SDRdaemonSinkSettings::ServerType) index;
|
||||
sendSettings();
|
||||
|
||||
QString typeCode = m_settings.m_serverType == SDRdaemonSinkSettings::ServerAngel ? "sdrangel" : "sdrdaemon";
|
||||
QString infoURL = QString("http://%1:%2/%3").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort).arg(typeCode);
|
||||
m_networkRequest.setUrl(QUrl(infoURL));
|
||||
m_networkManager->get(m_networkRequest);
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::on_deviceIndex_returnPressed()
|
||||
{
|
||||
bool dataOk;
|
||||
@ -377,8 +365,7 @@ void SDRdaemonSinkGui::on_apiAddress_returnPressed()
|
||||
m_settings.m_apiAddress = ui->apiAddress->text();
|
||||
sendSettings();
|
||||
|
||||
QString typeCode = m_settings.m_serverType == SDRdaemonSinkSettings::ServerAngel ? "sdrangel" : "sdrdaemon";
|
||||
QString infoURL = QString("http://%1:%2/%3").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort).arg(typeCode);
|
||||
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);
|
||||
}
|
||||
@ -396,8 +383,7 @@ void SDRdaemonSinkGui::on_apiPort_returnPressed()
|
||||
|
||||
sendSettings();
|
||||
|
||||
QString typeCode = m_settings.m_serverType == SDRdaemonSinkSettings::ServerAngel ? "sdrangel" : "sdrdaemon";
|
||||
QString infoURL = QString("http://%1:%2/%3").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort).arg(typeCode);
|
||||
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);
|
||||
}
|
||||
@ -436,8 +422,7 @@ void SDRdaemonSinkGui::on_apiApplyButton_clicked(bool checked __attribute__((unu
|
||||
|
||||
sendSettings();
|
||||
|
||||
QString typeCode = m_settings.m_serverType == SDRdaemonSinkSettings::ServerAngel ? "sdrangel" : "sdrdaemon";
|
||||
QString infoURL = QString("http://%1:%2/%3").arg(m_settings.m_apiAddress).arg(m_settings.m_apiPort).arg(typeCode);
|
||||
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);
|
||||
}
|
||||
@ -518,20 +503,11 @@ void SDRdaemonSinkGui::tick()
|
||||
{
|
||||
QString reportURL;
|
||||
|
||||
if (m_settings.m_serverType == SDRdaemonSinkSettings::ServerAngel) {
|
||||
reportURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/report")
|
||||
.arg(m_settings.m_apiAddress)
|
||||
.arg(m_settings.m_apiPort)
|
||||
.arg(m_settings.m_deviceIndex)
|
||||
.arg(m_settings.m_channelIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportURL = QString("http://%1:%2/sdrdaemon/channel/report")
|
||||
.arg(m_settings.m_apiAddress)
|
||||
.arg(m_settings.m_apiPort);
|
||||
}
|
||||
|
||||
reportURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/report")
|
||||
.arg(m_settings.m_apiAddress)
|
||||
.arg(m_settings.m_apiPort)
|
||||
.arg(m_settings.m_deviceIndex)
|
||||
.arg(m_settings.m_channelIndex);
|
||||
m_networkRequest.setUrl(QUrl(reportURL));
|
||||
m_networkManager->get(m_networkRequest);
|
||||
|
||||
|
@ -145,7 +145,6 @@ private slots:
|
||||
void on_sampleRate_changed(quint64 value);
|
||||
void on_txDelay_valueChanged(int value);
|
||||
void on_nbFECBlocks_valueChanged(int value);
|
||||
void on_serverType_currentIndexChanged(int index);
|
||||
void on_deviceIndex_returnPressed();
|
||||
void on_channelIndex_returnPressed();
|
||||
void on_apiAddress_returnPressed();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>300</height>
|
||||
<height>270</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,7 +19,7 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>300</height>
|
||||
<height>270</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -295,6 +295,58 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceIndexLabel">
|
||||
<property name="text">
|
||||
<string>Dev</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="deviceIndex">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Device index (for SDRangel server)</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="channelIndexLabel">
|
||||
<property name="text">
|
||||
<string>Ch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="channelIndex">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel index (for SDRangel)</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -520,92 +572,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="interfaceLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="serverType">
|
||||
<property name="toolTip">
|
||||
<string>Remote server type</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Angel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Daemon</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceIndexLabel">
|
||||
<property name="text">
|
||||
<string>Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="deviceIndex">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Device index (for SDRangel server)</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="channelIndexLabel">
|
||||
<property name="text">
|
||||
<string>Channel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="channelIndex">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel index (for SDRangel)</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="apiAddressLayout">
|
||||
<item>
|
||||
|
@ -14,6 +14,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
@ -52,9 +53,13 @@ SDRdaemonSinkOutput::SDRdaemonSinkOutput(DeviceSinkAPI *deviceAPI) :
|
||||
m_masterTimer(deviceAPI->getMasterTimer()),
|
||||
m_tickCount(0),
|
||||
m_tickMultiplier(20),
|
||||
m_lastRemoteSampleCount(0),
|
||||
m_lastSampleCount(0),
|
||||
m_lastRemoteTimestampUs(0),
|
||||
m_lastTimestampUs(0),
|
||||
m_lastRemoteTimestampRateCorrection(0),
|
||||
m_lastTimestampRateCorrection(0),
|
||||
m_nbRemoteSamplesSinceRateCorrection(0),
|
||||
m_nbSamplesSinceRateCorrection(0),
|
||||
m_chunkSizeCorrection(0)
|
||||
{
|
||||
@ -271,7 +276,7 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
|
||||
m_sdrDaemonSinkThread->setSamplerate(settings.m_sampleRate);
|
||||
}
|
||||
|
||||
m_tickMultiplier = (20*NbSamplesForRateCorrection) / (2*settings.m_sampleRate); // two times per sample filling period
|
||||
m_tickMultiplier = (21*NbSamplesForRateCorrection) / (2*settings.m_sampleRate); // two times per sample filling period plus small extension
|
||||
m_tickMultiplier = m_tickMultiplier < 20 ? 20 : m_tickMultiplier; // not below half a second
|
||||
|
||||
forwardChange = true;
|
||||
@ -396,12 +401,6 @@ int SDRdaemonSinkOutput::webapiSettingsPutPatch(
|
||||
if (deviceSettingsKeys.contains("dataPort")) {
|
||||
settings.m_dataPort = response.getSdrDaemonSinkSettings()->getDataPort();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("serverType")) {
|
||||
int serverType = response.getSdrDaemonSinkSettings()->getServerType();
|
||||
settings.m_serverType = serverType < 0 ? SDRdaemonSinkSettings::ServerAngel
|
||||
: serverType > 1 ? SDRdaemonSinkSettings::ServerAngel
|
||||
: (SDRdaemonSinkSettings::ServerType) serverType;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("deviceIndex")) {
|
||||
settings.m_deviceIndex = response.getSdrDaemonSinkSettings()->getDeviceIndex();
|
||||
}
|
||||
@ -442,15 +441,15 @@ void SDRdaemonSinkOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSetti
|
||||
response.getSdrDaemonSinkSettings()->setApiPort(settings.m_apiPort);
|
||||
response.getSdrDaemonSinkSettings()->setDataAddress(new QString(settings.m_dataAddress));
|
||||
response.getSdrDaemonSinkSettings()->setDataPort(settings.m_dataPort);
|
||||
response.getSdrDaemonSinkSettings()->setServerType((int) settings.m_serverType);
|
||||
response.getSdrDaemonSinkSettings()->setDeviceIndex(settings.m_deviceIndex);
|
||||
response.getSdrDaemonSinkSettings()->setChannelIndex(settings.m_channelIndex);
|
||||
}
|
||||
|
||||
void SDRdaemonSinkOutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
|
||||
{
|
||||
struct timeval tv;
|
||||
response.getSdrDaemonSinkReport()->setBufferRwBalance(m_sampleSourceFifo.getRWBalance());
|
||||
response.getSdrDaemonSinkReport()->setSampleCount(m_sdrDaemonSinkThread ? (int) m_sdrDaemonSinkThread->getSamplesCount() : 0);
|
||||
response.getSdrDaemonSinkReport()->setSampleCount(m_sdrDaemonSinkThread ? (int) m_sdrDaemonSinkThread->getSamplesCount(tv) : 0);
|
||||
}
|
||||
|
||||
void SDRdaemonSinkOutput::tick()
|
||||
@ -507,7 +506,9 @@ void SDRdaemonSinkOutput::networkManagerFinished(QNetworkReply *reply)
|
||||
|
||||
void SDRdaemonSinkOutput::analyzeApiReply(const QJsonObject& jsonObject)
|
||||
{
|
||||
QString infoLine;
|
||||
if (!m_sdrDaemonSinkThread) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (jsonObject.contains("SDRDaemonChannelSourceReport"))
|
||||
{
|
||||
@ -516,10 +517,20 @@ void SDRdaemonSinkOutput::analyzeApiReply(const QJsonObject& jsonObject)
|
||||
queueSize = queueSize == 0 ? 10 : queueSize;
|
||||
int queueLength = report["queueLength"].toInt();
|
||||
int queueLengthPercent = (queueLength*100)/queueSize;
|
||||
uint64_t timestampUs = report["tvSec"].toInt()*1000000ULL + report["tvUSec"].toInt();
|
||||
uint64_t remoteTimestampUs = report["tvSec"].toInt()*1000000ULL + report["tvUSec"].toInt();
|
||||
|
||||
uint32_t remoteSampleCountDelta, remoteSampleCount;
|
||||
remoteSampleCount = report["samplesCount"].toInt();
|
||||
|
||||
if (remoteSampleCount < m_lastRemoteSampleCount) {
|
||||
remoteSampleCountDelta = (0xFFFFFFFFU - m_lastRemoteSampleCount) + remoteSampleCount + 1;
|
||||
} else {
|
||||
remoteSampleCountDelta = remoteSampleCount - m_lastRemoteSampleCount;
|
||||
}
|
||||
|
||||
uint32_t sampleCountDelta, sampleCount;
|
||||
sampleCount = report["samplesCount"].toInt();
|
||||
struct timeval tv;
|
||||
sampleCount = m_sdrDaemonSinkThread->getSamplesCount(tv);
|
||||
|
||||
if (sampleCount < m_lastSampleCount) {
|
||||
sampleCountDelta = (0xFFFFFFFFU - m_lastSampleCount) + sampleCount + 1;
|
||||
@ -527,40 +538,49 @@ void SDRdaemonSinkOutput::analyzeApiReply(const QJsonObject& jsonObject)
|
||||
sampleCountDelta = sampleCount - m_lastSampleCount;
|
||||
}
|
||||
|
||||
if (m_lastTimestampRateCorrection == 0) {
|
||||
uint64_t timestampUs = tv.tv_sec*1000000ULL + tv.tv_usec;
|
||||
|
||||
if (m_lastRemoteTimestampRateCorrection == 0)
|
||||
{
|
||||
m_lastRemoteTimestampRateCorrection = remoteTimestampUs;
|
||||
m_lastTimestampRateCorrection = timestampUs;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nbRemoteSamplesSinceRateCorrection += remoteSampleCountDelta;
|
||||
m_nbSamplesSinceRateCorrection += sampleCountDelta;
|
||||
|
||||
qDebug("SDRdaemonSinkOutput::analyzeApiReply: queueLengthPercent: %d sampleCount: %u m_nbSamplesSinceRateCorrection: %u",
|
||||
qDebug("SDRdaemonSinkOutput::analyzeApiReply: queueLengthPercent: %d m_nbSamplesSinceRateCorrection: %u",
|
||||
queueLengthPercent,
|
||||
sampleCount,
|
||||
m_nbSamplesSinceRateCorrection);
|
||||
m_nbRemoteSamplesSinceRateCorrection);
|
||||
|
||||
if ((m_nbSamplesSinceRateCorrection > NbSamplesForRateCorrection) && ((queueLengthPercent > 60) || (queueLengthPercent < 40)))
|
||||
if (m_nbRemoteSamplesSinceRateCorrection > NbSamplesForRateCorrection)
|
||||
{
|
||||
sampleRateCorrection(queueLength, queueSize, timestampUs - m_lastTimestampRateCorrection);
|
||||
sampleRateCorrection(remoteTimestampUs - m_lastRemoteTimestampRateCorrection,
|
||||
timestampUs - m_lastTimestampRateCorrection,
|
||||
m_nbRemoteSamplesSinceRateCorrection,
|
||||
m_nbSamplesSinceRateCorrection);
|
||||
m_lastRemoteTimestampRateCorrection = remoteTimestampUs;
|
||||
m_lastTimestampRateCorrection = timestampUs;
|
||||
m_nbRemoteSamplesSinceRateCorrection = 0;
|
||||
m_nbSamplesSinceRateCorrection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
m_lastRemoteSampleCount = remoteSampleCount;
|
||||
m_lastSampleCount = sampleCount;
|
||||
m_lastTimestampUs = timestampUs;
|
||||
m_lastRemoteTimestampUs = remoteTimestampUs; // TODO: remove
|
||||
m_lastTimestampUs = timestampUs; // TODO: remove
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonSinkOutput::sampleRateCorrection(int queueLength, int queueSize, int64_t timeDeltaUs)
|
||||
void SDRdaemonSinkOutput::sampleRateCorrection(double remoteTimeDeltaUs, double timeDeltaUs, uint32_t remoteSampleCount, uint32_t sampleCount)
|
||||
{
|
||||
int nbBlocksDiff = queueLength - (queueSize/2);
|
||||
int nbSamplesDiff = nbBlocksDiff * 127 * 127;
|
||||
float sampleCorr = (nbSamplesDiff * 50000.0) / timeDeltaUs; // correction for ~50ms chunks (50000 us)
|
||||
int chunkCorr = -roundf(sampleCorr);
|
||||
m_chunkSizeCorrection += chunkCorr;
|
||||
double deltaSR = (remoteSampleCount/remoteTimeDeltaUs) - (sampleCount/timeDeltaUs);
|
||||
double chunkCorr = 50000 * deltaSR; // for 50ms chunk intervals (50000us)
|
||||
m_chunkSizeCorrection += roundf(chunkCorr);
|
||||
|
||||
qDebug("SDRdaemonSinkOutput::sampleRateCorrection: %d (%d) samples", m_chunkSizeCorrection, chunkCorr);
|
||||
qDebug("SDRdaemonSinkOutput::sampleRateCorrection: %d (%f) samples", m_chunkSizeCorrection, chunkCorr);
|
||||
|
||||
MsgConfigureSDRdaemonSinkChunkCorrection* message = MsgConfigureSDRdaemonSinkChunkCorrection::create(m_chunkSizeCorrection);
|
||||
getInputMessageQueue()->push(message);
|
||||
|
@ -178,9 +178,13 @@ private:
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
uint32_t m_lastRemoteSampleCount;
|
||||
uint32_t m_lastSampleCount;
|
||||
uint64_t m_lastRemoteTimestampUs;
|
||||
uint64_t m_lastTimestampUs;
|
||||
uint64_t m_lastRemoteTimestampRateCorrection;
|
||||
uint64_t m_lastTimestampRateCorrection;
|
||||
uint32_t m_nbRemoteSamplesSinceRateCorrection;
|
||||
uint32_t m_nbSamplesSinceRateCorrection;
|
||||
int m_chunkSizeCorrection;
|
||||
static const uint32_t NbSamplesForRateCorrection;
|
||||
@ -190,7 +194,7 @@ private:
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
|
||||
void analyzeApiReply(const QJsonObject& jsonObject);
|
||||
void sampleRateCorrection(int queueLength, int queueSize, int64_t timeDeltaUs);
|
||||
void sampleRateCorrection(double remoteTimeDeltaUs, double timeDeltaUs, uint32_t remoteSampleCount, uint32_t sampleCount);
|
||||
|
||||
private slots:
|
||||
void tick();
|
||||
|
@ -32,7 +32,6 @@ void SDRdaemonSinkSettings::resetToDefaults()
|
||||
m_apiPort = 9091;
|
||||
m_dataAddress = "127.0.0.1";
|
||||
m_dataPort = 9090;
|
||||
m_serverType = ServerAngel;
|
||||
m_deviceIndex = 0;
|
||||
m_channelIndex = 0;
|
||||
}
|
||||
@ -49,7 +48,6 @@ QByteArray SDRdaemonSinkSettings::serialize() const
|
||||
s.writeU32(6, m_apiPort);
|
||||
s.writeString(7, m_dataAddress);
|
||||
s.writeU32(8, m_dataPort);
|
||||
s.writeS32(9, (int) m_serverType);
|
||||
s.writeU32(10, m_deviceIndex);
|
||||
s.writeU32(11, m_channelIndex);
|
||||
|
||||
@ -69,7 +67,6 @@ bool SDRdaemonSinkSettings::deserialize(const QByteArray& data)
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
quint32 uintval;
|
||||
int intval;
|
||||
|
||||
d.readU64(1, &m_centerFrequency, 435000*1000);
|
||||
d.readU32(2, &m_sampleRate, 48000);
|
||||
@ -81,14 +78,6 @@ bool SDRdaemonSinkSettings::deserialize(const QByteArray& data)
|
||||
d.readString(7, &m_dataAddress, "127.0.0.1");
|
||||
d.readU32(8, &uintval, 9090);
|
||||
m_dataPort = uintval % (1<<16);
|
||||
d.readS32(9, &intval, 0);
|
||||
|
||||
if ((intval < 0) || (intval > 1)) {
|
||||
m_serverType = ServerAngel;
|
||||
} else {
|
||||
m_serverType = (ServerType) intval;
|
||||
}
|
||||
|
||||
d.readU32(10, &m_deviceIndex, 0);
|
||||
d.readU32(11, &m_channelIndex, 0);
|
||||
|
||||
|
@ -20,12 +20,6 @@
|
||||
#include <QByteArray>
|
||||
|
||||
struct SDRdaemonSinkSettings {
|
||||
|
||||
typedef enum {
|
||||
ServerAngel = 0,
|
||||
ServerDaemon
|
||||
} ServerType;
|
||||
|
||||
quint64 m_centerFrequency;
|
||||
quint32 m_sampleRate;
|
||||
float m_txDelay;
|
||||
@ -34,7 +28,6 @@ struct SDRdaemonSinkSettings {
|
||||
quint16 m_apiPort;
|
||||
QString m_dataAddress;
|
||||
quint16 m_dataPort;
|
||||
ServerType m_serverType;
|
||||
quint32 m_deviceIndex;
|
||||
quint32 m_channelIndex;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@ -136,3 +137,9 @@ void SDRdaemonSinkThread::tick()
|
||||
m_udpSinkFEC.write(beginRead, m_samplesChunkSize);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t SDRdaemonSinkThread::getSamplesCount(struct timeval& tv) const
|
||||
{
|
||||
gettimeofday(&tv, 0);
|
||||
return m_samplesCount;
|
||||
}
|
||||
|
@ -17,15 +17,16 @@
|
||||
#ifndef INCLUDE_SDRDAEMONSINKTHREAD_H
|
||||
#define INCLUDE_SDRDAEMONSINKTHREAD_H
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QTimer>
|
||||
#include <QElapsedTimer>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "dsp/inthalfbandfilter.h"
|
||||
#include "dsp/interpolators.h"
|
||||
@ -35,6 +36,7 @@
|
||||
#define SDRDAEMONSINK_THROTTLE_MS 50
|
||||
|
||||
class SampleSourceFifo;
|
||||
struct timeval;
|
||||
|
||||
class SDRdaemonSinkThread : public QThread {
|
||||
Q_OBJECT
|
||||
@ -54,7 +56,7 @@ public:
|
||||
|
||||
bool isRunning() const { return m_running; }
|
||||
|
||||
uint32_t getSamplesCount() const { return m_samplesCount; }
|
||||
uint32_t getSamplesCount(struct timeval& tv) const;
|
||||
void setSamplesCount(int samplesCount) { m_samplesCount = samplesCount; }
|
||||
void setChunkCorrection(int chunkCorrection) { m_chunkCorrection = chunkCorrection; }
|
||||
|
||||
|
@ -3368,9 +3368,6 @@ margin-bottom: 20px;
|
||||
"dataPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"serverType" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"deviceIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
@ -28719,7 +28716,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-09-02T19:22:42.257+02:00
|
||||
Generated 2018-09-04T08:40:33.765+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,11 +20,11 @@ SDRdaemonSinkSettings:
|
||||
type: string
|
||||
dataPort:
|
||||
type: integer
|
||||
serverType:
|
||||
type: integer
|
||||
deviceIndex:
|
||||
device: remote SDRangel instance deviceset index
|
||||
type: integer
|
||||
channelIndex:
|
||||
device: remote SDRangel instance channel index
|
||||
type: integer
|
||||
|
||||
SDRdaemonSinkReport:
|
||||
|
@ -20,11 +20,11 @@ SDRdaemonSinkSettings:
|
||||
type: string
|
||||
dataPort:
|
||||
type: integer
|
||||
serverType:
|
||||
type: integer
|
||||
deviceIndex:
|
||||
device: remote SDRangel instance deviceset index
|
||||
type: integer
|
||||
channelIndex:
|
||||
device: remote SDRangel instance channel index
|
||||
type: integer
|
||||
|
||||
SDRdaemonSinkReport:
|
||||
|
@ -3368,9 +3368,6 @@ margin-bottom: 20px;
|
||||
"dataPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"serverType" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"deviceIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
@ -28719,7 +28716,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-09-02T19:22:42.257+02:00
|
||||
Generated 2018-09-04T08:40:33.765+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,8 +44,6 @@ SWGSDRdaemonSinkSettings::SWGSDRdaemonSinkSettings() {
|
||||
m_data_address_isSet = false;
|
||||
data_port = 0;
|
||||
m_data_port_isSet = false;
|
||||
server_type = 0;
|
||||
m_server_type_isSet = false;
|
||||
device_index = 0;
|
||||
m_device_index_isSet = false;
|
||||
channel_index = 0;
|
||||
@ -74,8 +72,6 @@ SWGSDRdaemonSinkSettings::init() {
|
||||
m_data_address_isSet = false;
|
||||
data_port = 0;
|
||||
m_data_port_isSet = false;
|
||||
server_type = 0;
|
||||
m_server_type_isSet = false;
|
||||
device_index = 0;
|
||||
m_device_index_isSet = false;
|
||||
channel_index = 0;
|
||||
@ -98,7 +94,6 @@ SWGSDRdaemonSinkSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGSDRdaemonSinkSettings*
|
||||
@ -128,8 +123,6 @@ SWGSDRdaemonSinkSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&data_port, pJson["dataPort"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&server_type, pJson["serverType"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&device_index, pJson["deviceIndex"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&channel_index, pJson["channelIndex"], "qint32", "");
|
||||
@ -174,9 +167,6 @@ SWGSDRdaemonSinkSettings::asJsonObject() {
|
||||
if(m_data_port_isSet){
|
||||
obj->insert("dataPort", QJsonValue(data_port));
|
||||
}
|
||||
if(m_server_type_isSet){
|
||||
obj->insert("serverType", QJsonValue(server_type));
|
||||
}
|
||||
if(m_device_index_isSet){
|
||||
obj->insert("deviceIndex", QJsonValue(device_index));
|
||||
}
|
||||
@ -267,16 +257,6 @@ SWGSDRdaemonSinkSettings::setDataPort(qint32 data_port) {
|
||||
this->m_data_port_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGSDRdaemonSinkSettings::getServerType() {
|
||||
return server_type;
|
||||
}
|
||||
void
|
||||
SWGSDRdaemonSinkSettings::setServerType(qint32 server_type) {
|
||||
this->server_type = server_type;
|
||||
this->m_server_type_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGSDRdaemonSinkSettings::getDeviceIndex() {
|
||||
return device_index;
|
||||
@ -310,7 +290,6 @@ SWGSDRdaemonSinkSettings::isSet(){
|
||||
if(m_api_port_isSet){ isObjectUpdated = true; break;}
|
||||
if(data_address != nullptr && *data_address != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_data_port_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_server_type_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_device_index_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_channel_index_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
|
@ -66,9 +66,6 @@ public:
|
||||
qint32 getDataPort();
|
||||
void setDataPort(qint32 data_port);
|
||||
|
||||
qint32 getServerType();
|
||||
void setServerType(qint32 server_type);
|
||||
|
||||
qint32 getDeviceIndex();
|
||||
void setDeviceIndex(qint32 device_index);
|
||||
|
||||
@ -103,9 +100,6 @@ private:
|
||||
qint32 data_port;
|
||||
bool m_data_port_isSet;
|
||||
|
||||
qint32 server_type;
|
||||
bool m_server_type_isSet;
|
||||
|
||||
qint32 device_index;
|
||||
bool m_device_index_isSet;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user