1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

SDRdaemonFEC: renamed all SDRdaemonFECxxx classes to SDRdaemonSourcexxx classes

This commit is contained in:
f4exb 2017-06-09 14:14:32 +02:00
parent 3d5efd7dba
commit 718d87ecf5
13 changed files with 189 additions and 189 deletions

View File

@ -25,7 +25,7 @@
#define SDRDAEMONFEC_UDPSIZE 512 // UDP payload size #define SDRDAEMONFEC_UDPSIZE 512 // UDP payload size
#define SDRDAEMONFEC_NBORIGINALBLOCKS 128 // number of sample blocks per frame excluding FEC blocks #define SDRDAEMONSOURCE_NBORIGINALBLOCKS 128 // number of sample blocks per frame excluding FEC blocks
#define SDRDAEMONFEC_NBDECODERSLOTS 16 // power of two sub multiple of uint16_t size. A too large one is superfluous. #define SDRDAEMONFEC_NBDECODERSLOTS 16 // power of two sub multiple of uint16_t size. A too large one is superfluous.
class SDRdaemonFECBuffer class SDRdaemonFECBuffer
@ -69,7 +69,7 @@ public:
}; };
static const int samplesPerBlock = (SDRDAEMONFEC_UDPSIZE - sizeof(Header)) / sizeof(Sample); static const int samplesPerBlock = (SDRDAEMONFEC_UDPSIZE - sizeof(Header)) / sizeof(Sample);
static const int framesSize = SDRDAEMONFEC_NBDECODERSLOTS * (SDRDAEMONFEC_NBORIGINALBLOCKS - 1) * (SDRDAEMONFEC_UDPSIZE - sizeof(Header)); static const int framesSize = SDRDAEMONFEC_NBDECODERSLOTS * (SDRDAEMONSOURCE_NBORIGINALBLOCKS - 1) * (SDRDAEMONFEC_UDPSIZE - sizeof(Header));
struct ProtectedBlock struct ProtectedBlock
{ {
@ -156,7 +156,7 @@ public:
} }
static const int m_udpPayloadSize = SDRDAEMONFEC_UDPSIZE; static const int m_udpPayloadSize = SDRDAEMONFEC_UDPSIZE;
static const int m_nbOriginalBlocks = SDRDAEMONFEC_NBORIGINALBLOCKS; static const int m_nbOriginalBlocks = SDRDAEMONSOURCE_NBORIGINALBLOCKS;
static const int m_sampleSize; static const int m_sampleSize;
static const int m_iqSampleSize; static const int m_iqSampleSize;

View File

@ -25,10 +25,10 @@
const int SDRdaemonFECBuffer::m_sampleSize = 2; const int SDRdaemonSourceBuffer::m_sampleSize = 2;
const int SDRdaemonFECBuffer::m_iqSampleSize = 2 * m_sampleSize; const int SDRdaemonSourceBuffer::m_iqSampleSize = 2 * m_sampleSize;
SDRdaemonFECBuffer::SDRdaemonFECBuffer(uint32_t throttlems) : SDRdaemonSourceBuffer::SDRdaemonSourceBuffer(uint32_t throttlems) :
m_decoderIndexHead(nbDecoderSlots/2), m_decoderIndexHead(nbDecoderSlots/2),
m_frameHead(0), m_frameHead(0),
m_curNbBlocks(0), m_curNbBlocks(0),
@ -65,14 +65,14 @@ SDRdaemonFECBuffer::SDRdaemonFECBuffer(uint32_t throttlems) :
} }
} }
SDRdaemonFECBuffer::~SDRdaemonFECBuffer() SDRdaemonSourceBuffer::~SDRdaemonSourceBuffer()
{ {
if (m_readBuffer) { if (m_readBuffer) {
delete[] m_readBuffer; delete[] m_readBuffer;
} }
} }
void SDRdaemonFECBuffer::initDecodeAllSlots() void SDRdaemonSourceBuffer::initDecodeAllSlots()
{ {
for (int i = 0; i < nbDecoderSlots; i++) for (int i = 0; i < nbDecoderSlots; i++)
{ {
@ -86,7 +86,7 @@ void SDRdaemonFECBuffer::initDecodeAllSlots()
} }
} }
void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex) void SDRdaemonSourceBuffer::initDecodeSlot(int slotIndex)
{ {
// collect stats before voiding the slot // collect stats before voiding the slot
@ -122,7 +122,7 @@ void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex)
memset((void *) m_decoderSlots[slotIndex].m_recoveryBlocks, 0, m_nbOriginalBlocks * sizeof(ProtectedBlock)); memset((void *) m_decoderSlots[slotIndex].m_recoveryBlocks, 0, m_nbOriginalBlocks * sizeof(ProtectedBlock));
} }
void SDRdaemonFECBuffer::initReadIndex() void SDRdaemonSourceBuffer::initReadIndex()
{ {
m_readIndex = ((m_decoderIndexHead + (nbDecoderSlots/2)) % nbDecoderSlots) * sizeof(BufferFrame); m_readIndex = ((m_decoderIndexHead + (nbDecoderSlots/2)) % nbDecoderSlots) * sizeof(BufferFrame);
m_wrDeltaEstimate = m_framesNbBytes / 2; m_wrDeltaEstimate = m_framesNbBytes / 2;
@ -130,7 +130,7 @@ void SDRdaemonFECBuffer::initReadIndex()
m_nbWrites = 0; m_nbWrites = 0;
} }
void SDRdaemonFECBuffer::rwCorrectionEstimate(int slotIndex) void SDRdaemonSourceBuffer::rwCorrectionEstimate(int slotIndex)
{ {
if (m_nbReads >= 40) // check every ~1s as tick is ~50ms if (m_nbReads >= 40) // check every ~1s as tick is ~50ms
{ {
@ -163,7 +163,7 @@ void SDRdaemonFECBuffer::rwCorrectionEstimate(int slotIndex)
} }
} }
void SDRdaemonFECBuffer::checkSlotData(int slotIndex) void SDRdaemonSourceBuffer::checkSlotData(int slotIndex)
{ {
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame); int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex; m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
@ -188,7 +188,7 @@ void SDRdaemonFECBuffer::checkSlotData(int slotIndex)
} }
} }
void SDRdaemonFECBuffer::writeData(char *array) void SDRdaemonSourceBuffer::writeData(char *array)
{ {
SuperBlock *superBlock = (SuperBlock *) array; SuperBlock *superBlock = (SuperBlock *) array;
int frameIndex = superBlock->header.frameIndex; int frameIndex = superBlock->header.frameIndex;
@ -321,7 +321,7 @@ void SDRdaemonFECBuffer::writeData(char *array)
} // decode } // decode
} }
void SDRdaemonFECBuffer::writeData0(char *array __attribute__((unused)), uint32_t length __attribute__((unused))) void SDRdaemonSourceBuffer::writeData0(char *array __attribute__((unused)), uint32_t length __attribute__((unused)))
{ {
// Kept as comments for the out of sync blocks algorithms // Kept as comments for the out of sync blocks algorithms
// assert(length == m_udpPayloadSize); // assert(length == m_udpPayloadSize);
@ -394,7 +394,7 @@ void SDRdaemonFECBuffer::writeData0(char *array __attribute__((unused)), uint32_
// //
} }
uint8_t *SDRdaemonFECBuffer::readData(int32_t length) uint8_t *SDRdaemonSourceBuffer::readData(int32_t length)
{ {
uint8_t *buffer = (uint8_t *) m_frames; uint8_t *buffer = (uint8_t *) m_frames;
uint32_t readIndex = m_readIndex; uint32_t readIndex = m_readIndex;
@ -436,7 +436,7 @@ uint8_t *SDRdaemonFECBuffer::readData(int32_t length)
} }
} }
void SDRdaemonFECBuffer::printMeta(const QString& header, MetaDataFEC *metaData) void SDRdaemonSourceBuffer::printMeta(const QString& header, MetaDataFEC *metaData)
{ {
qDebug() << header << ": " qDebug() << header << ": "
<< "|" << metaData->m_centerFrequency << "|" << metaData->m_centerFrequency

View File

@ -24,11 +24,11 @@
#include "util/movingaverage.h" #include "util/movingaverage.h"
#define SDRDAEMONFEC_UDPSIZE 512 // UDP payload size #define SDRDAEMONSOURCE_UDPSIZE 512 // UDP payload size
#define SDRDAEMONFEC_NBORIGINALBLOCKS 128 // number of sample blocks per frame excluding FEC blocks #define SDRDAEMONSOURCE_NBORIGINALBLOCKS 128 // number of sample blocks per frame excluding FEC blocks
#define SDRDAEMONFEC_NBDECODERSLOTS 16 // power of two sub multiple of uint16_t size. A too large one is superfluous. #define SDRDAEMONSOURCE_NBDECODERSLOTS 16 // power of two sub multiple of uint16_t size. A too large one is superfluous.
class SDRdaemonFECBuffer class SDRdaemonSourceBuffer
{ {
public: public:
#pragma pack(push, 1) #pragma pack(push, 1)
@ -68,8 +68,8 @@ public:
uint8_t filler; uint8_t filler;
}; };
static const int samplesPerBlock = (SDRDAEMONFEC_UDPSIZE - sizeof(Header)) / sizeof(Sample); static const int samplesPerBlock = (SDRDAEMONSOURCE_UDPSIZE - sizeof(Header)) / sizeof(Sample);
static const int framesSize = SDRDAEMONFEC_NBDECODERSLOTS * (SDRDAEMONFEC_NBORIGINALBLOCKS - 1) * (SDRDAEMONFEC_UDPSIZE - sizeof(Header)); static const int framesSize = SDRDAEMONSOURCE_NBDECODERSLOTS * (SDRDAEMONSOURCE_NBORIGINALBLOCKS - 1) * (SDRDAEMONSOURCE_UDPSIZE - sizeof(Header));
struct ProtectedBlock struct ProtectedBlock
{ {
@ -83,8 +83,8 @@ public:
}; };
#pragma pack(pop) #pragma pack(pop)
SDRdaemonFECBuffer(uint32_t throttlems); SDRdaemonSourceBuffer(uint32_t throttlems);
~SDRdaemonFECBuffer(); ~SDRdaemonSourceBuffer();
// R/W operations // R/W operations
void writeData(char *array); //!< Write data into buffer. void writeData(char *array); //!< Write data into buffer.
@ -156,13 +156,13 @@ public:
} }
} }
static const int m_udpPayloadSize = SDRDAEMONFEC_UDPSIZE; static const int m_udpPayloadSize = SDRDAEMONSOURCE_UDPSIZE;
static const int m_nbOriginalBlocks = SDRDAEMONFEC_NBORIGINALBLOCKS; static const int m_nbOriginalBlocks = SDRDAEMONSOURCE_NBORIGINALBLOCKS;
static const int m_sampleSize; static const int m_sampleSize;
static const int m_iqSampleSize; static const int m_iqSampleSize;
private: private:
static const int nbDecoderSlots = SDRDAEMONFEC_NBDECODERSLOTS; static const int nbDecoderSlots = SDRDAEMONSOURCE_NBDECODERSLOTS;
#pragma pack(push, 1) #pragma pack(push, 1)
struct BufferFrame struct BufferFrame

View File

@ -41,7 +41,7 @@
#include <dsp/filerecord.h> #include <dsp/filerecord.h>
#include "sdrdaemonsourcegui.h" #include "sdrdaemonsourcegui.h"
SDRdaemonFECGui::SDRdaemonFECGui(DeviceSourceAPI *deviceAPI, QWidget* parent) : SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::SDRdaemonSourceGui), ui(new Ui::SDRdaemonSourceGui),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
@ -98,7 +98,7 @@ SDRdaemonFECGui::SDRdaemonFECGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
connect(&(deviceAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); connect(&(deviceAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
m_sampleSource = new SDRdaemonFECInput(deviceAPI->getMainWindow()->getMasterTimer(), m_deviceAPI); m_sampleSource = new SDRdaemonSourceInput(deviceAPI->getMainWindow()->getMasterTimer(), m_deviceAPI);
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
m_deviceAPI->setSource(m_sampleSource); m_deviceAPI->setSource(m_sampleSource);
@ -120,7 +120,7 @@ SDRdaemonFECGui::SDRdaemonFECGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
sendSettings(); sendSettings();
} }
SDRdaemonFECGui::~SDRdaemonFECGui() SDRdaemonSourceGui::~SDRdaemonSourceGui()
{ {
m_deviceAPI->removeSink(m_fileSink); m_deviceAPI->removeSink(m_fileSink);
delete m_fileSink; delete m_fileSink;
@ -128,27 +128,27 @@ SDRdaemonFECGui::~SDRdaemonFECGui()
delete ui; delete ui;
} }
void SDRdaemonFECGui::blockApplySettings(bool block) void SDRdaemonSourceGui::blockApplySettings(bool block)
{ {
m_doApplySettings = !block; m_doApplySettings = !block;
} }
void SDRdaemonFECGui::destroy() void SDRdaemonSourceGui::destroy()
{ {
delete this; delete this;
} }
void SDRdaemonFECGui::setName(const QString& name) void SDRdaemonSourceGui::setName(const QString& name)
{ {
setObjectName(name); setObjectName(name);
} }
QString SDRdaemonFECGui::getName() const QString SDRdaemonSourceGui::getName() const
{ {
return objectName(); return objectName();
} }
void SDRdaemonFECGui::resetToDefaults() void SDRdaemonSourceGui::resetToDefaults()
{ {
blockApplySettings(true); blockApplySettings(true);
m_settings.resetToDefaults(); m_settings.resetToDefaults();
@ -157,12 +157,12 @@ void SDRdaemonFECGui::resetToDefaults()
sendSettings(); sendSettings();
} }
QByteArray SDRdaemonFECGui::serialize() const QByteArray SDRdaemonSourceGui::serialize() const
{ {
return m_settings.serialize(); return m_settings.serialize();
} }
bool SDRdaemonFECGui::deserialize(const QByteArray& data) bool SDRdaemonSourceGui::deserialize(const QByteArray& data)
{ {
blockApplySettings(true); blockApplySettings(true);
@ -185,12 +185,12 @@ bool SDRdaemonFECGui::deserialize(const QByteArray& data)
} }
} }
qint64 SDRdaemonFECGui::getCenterFrequency() const qint64 SDRdaemonSourceGui::getCenterFrequency() const
{ {
return m_settings.m_centerFrequency; return m_settings.m_centerFrequency;
} }
void SDRdaemonFECGui::setCenterFrequency(qint64 centerFrequency) void SDRdaemonSourceGui::setCenterFrequency(qint64 centerFrequency)
{ {
m_settings.m_centerFrequency = centerFrequency; m_settings.m_centerFrequency = centerFrequency;
displaySettings(); displaySettings();
@ -198,17 +198,17 @@ void SDRdaemonFECGui::setCenterFrequency(qint64 centerFrequency)
sendSettings(); sendSettings();
} }
bool SDRdaemonFECGui::handleMessage(const Message& message) bool SDRdaemonSourceGui::handleMessage(const Message& message)
{ {
if (SDRdaemonFECInput::MsgReportSDRdaemonAcquisition::match(message)) if (SDRdaemonSourceInput::MsgReportSDRdaemonAcquisition::match(message))
{ {
m_acquisition = ((SDRdaemonFECInput::MsgReportSDRdaemonAcquisition&)message).getAcquisition(); m_acquisition = ((SDRdaemonSourceInput::MsgReportSDRdaemonAcquisition&)message).getAcquisition();
updateWithAcquisition(); updateWithAcquisition();
return true; return true;
} }
else if (SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData::match(message)) else if (SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData::match(message))
{ {
int sampleRate = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).getSampleRate(); int sampleRate = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData&)message).getSampleRate();
if (m_sampleRate != sampleRate) if (m_sampleRate != sampleRate)
{ {
@ -217,30 +217,30 @@ bool SDRdaemonFECGui::handleMessage(const Message& message)
sendControl(); sendControl();
} }
m_centerFrequency = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).getCenterFrequency(); m_centerFrequency = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData&)message).getCenterFrequency();
m_startingTimeStamp.tv_sec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).get_tv_sec(); m_startingTimeStamp.tv_sec = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData&)message).get_tv_sec();
m_startingTimeStamp.tv_usec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).get_tv_usec(); m_startingTimeStamp.tv_usec = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData&)message).get_tv_usec();
updateWithStreamData(); updateWithStreamData();
return true; return true;
} }
else if (SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming::match(message)) else if (SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming::match(message))
{ {
m_startingTimeStamp.tv_sec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).get_tv_sec(); m_startingTimeStamp.tv_sec = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).get_tv_sec();
m_startingTimeStamp.tv_usec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).get_tv_usec(); m_startingTimeStamp.tv_usec = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).get_tv_usec();
m_framesDecodingStatus = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getFramesDecodingStatus(); m_framesDecodingStatus = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getFramesDecodingStatus();
m_allBlocksReceived = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).allBlocksReceived(); m_allBlocksReceived = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).allBlocksReceived();
m_bufferLengthInSecs = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferLengthInSecs(); m_bufferLengthInSecs = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getBufferLengthInSecs();
m_bufferGauge = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferGauge(); m_bufferGauge = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getBufferGauge();
m_minNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMinNbBlocks(); m_minNbBlocks = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getMinNbBlocks();
m_minNbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMinNbOriginalBlocks(); m_minNbOriginalBlocks = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getMinNbOriginalBlocks();
m_maxNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMaxNbRecovery(); m_maxNbRecovery = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getMaxNbRecovery();
m_avgNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbBlocks(); m_avgNbBlocks = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getAvgNbBlocks();
m_avgNbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbOriginalBlocks(); m_avgNbOriginalBlocks = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getAvgNbOriginalBlocks();
m_avgNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbRecovery(); m_avgNbRecovery = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getAvgNbRecovery();
m_nbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbOriginalBlocksPerFrame(); m_nbOriginalBlocks = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getNbOriginalBlocksPerFrame();
int nbFECBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbFECBlocksPerFrame(); int nbFECBlocks = ((SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming&)message).getNbFECBlocksPerFrame();
if (m_nbFECBlocks != nbFECBlocks) if (m_nbFECBlocks != nbFECBlocks)
{ {
@ -258,7 +258,7 @@ bool SDRdaemonFECGui::handleMessage(const Message& message)
} }
} }
void SDRdaemonFECGui::handleDSPMessages() void SDRdaemonSourceGui::handleDSPMessages()
{ {
Message* message; Message* message;
@ -280,7 +280,7 @@ void SDRdaemonFECGui::handleDSPMessages()
} }
} }
void SDRdaemonFECGui::handleSourceMessages() void SDRdaemonSourceGui::handleSourceMessages()
{ {
Message* message; Message* message;
@ -295,20 +295,20 @@ void SDRdaemonFECGui::handleSourceMessages()
} }
} }
void SDRdaemonFECGui::updateSampleRateAndFrequency() void SDRdaemonSourceGui::updateSampleRateAndFrequency()
{ {
m_deviceAPI->getSpectrum()->setSampleRate(m_deviceSampleRate); m_deviceAPI->getSpectrum()->setSampleRate(m_deviceSampleRate);
m_deviceAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); m_deviceAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateText->setText(tr("%1k").arg((float)m_deviceSampleRate / 1000)); ui->deviceRateText->setText(tr("%1k").arg((float)m_deviceSampleRate / 1000));
} }
void SDRdaemonFECGui::updateTxDelay() void SDRdaemonSourceGui::updateTxDelay()
{ {
m_txDelay = ((127*127*m_settings.m_txDelay) / m_sampleRate)/(128 + m_nbFECBlocks); m_txDelay = ((127*127*m_settings.m_txDelay) / m_sampleRate)/(128 + m_nbFECBlocks);
ui->txDelayText->setToolTip(tr("%1 us").arg(QString::number(m_txDelay*1e6, 'f', 0))); ui->txDelayText->setToolTip(tr("%1 us").arg(QString::number(m_txDelay*1e6, 'f', 0)));
} }
void SDRdaemonFECGui::displaySettings() void SDRdaemonSourceGui::displaySettings()
{ {
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->deviceRateText->setText(tr("%1k").arg(m_sampleRate / 1000.0)); ui->deviceRateText->setText(tr("%1k").arg(m_sampleRate / 1000.0));
@ -336,10 +336,10 @@ void SDRdaemonFECGui::displaySettings()
ui->iqImbalance->setChecked(m_settings.m_iqCorrection); ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
} }
void SDRdaemonFECGui::sendControl(bool force) void SDRdaemonSourceGui::sendControl(bool force)
{ {
QString remoteAddress; QString remoteAddress;
((SDRdaemonFECInput *) m_sampleSource)->getRemoteAddress(remoteAddress); ((SDRdaemonSourceInput *) m_sampleSource)->getRemoteAddress(remoteAddress);
if ((remoteAddress != m_remoteAddress) || if ((remoteAddress != m_remoteAddress) ||
(m_settings.m_controlPort != m_controlSettings.m_controlPort) || force) (m_settings.m_controlPort != m_controlSettings.m_controlPort) || force)
@ -454,13 +454,13 @@ void SDRdaemonFECGui::sendControl(bool force)
m_controlSettings.m_specificParameters = m_settings.m_specificParameters; m_controlSettings.m_specificParameters = m_settings.m_specificParameters;
} }
void SDRdaemonFECGui::sendSettings() void SDRdaemonSourceGui::sendSettings()
{ {
if(!m_updateTimer.isActive()) if(!m_updateTimer.isActive())
m_updateTimer.start(100); m_updateTimer.start(100);
} }
void SDRdaemonFECGui::on_applyButton_clicked(bool checked __attribute__((unused))) void SDRdaemonSourceGui::on_applyButton_clicked(bool checked __attribute__((unused)))
{ {
m_settings.m_address = ui->address->text(); m_settings.m_address = ui->address->text();
@ -483,20 +483,20 @@ void SDRdaemonFECGui::on_applyButton_clicked(bool checked __attribute__((unused)
configureUDPLink(); configureUDPLink();
} }
void SDRdaemonFECGui::on_sendButton_clicked(bool checked __attribute__((unused))) void SDRdaemonSourceGui::on_sendButton_clicked(bool checked __attribute__((unused)))
{ {
updateTxDelay(); updateTxDelay();
sendControl(true); sendControl(true);
ui->specificParms->setCursorPosition(0); ui->specificParms->setCursorPosition(0);
} }
void SDRdaemonFECGui::on_address_returnPressed() void SDRdaemonSourceGui::on_address_returnPressed()
{ {
m_settings.m_address = ui->address->text(); m_settings.m_address = ui->address->text();
configureUDPLink(); configureUDPLink();
} }
void SDRdaemonFECGui::on_dataPort_returnPressed() void SDRdaemonSourceGui::on_dataPort_returnPressed()
{ {
bool dataOk; bool dataOk;
int udpDataPort = ui->dataPort->text().toInt(&dataOk); int udpDataPort = ui->dataPort->text().toInt(&dataOk);
@ -513,7 +513,7 @@ void SDRdaemonFECGui::on_dataPort_returnPressed()
configureUDPLink(); configureUDPLink();
} }
void SDRdaemonFECGui::on_controlPort_returnPressed() void SDRdaemonSourceGui::on_controlPort_returnPressed()
{ {
bool ctlOk; bool ctlOk;
int udpCtlPort = ui->controlPort->text().toInt(&ctlOk); int udpCtlPort = ui->controlPort->text().toInt(&ctlOk);
@ -530,7 +530,7 @@ void SDRdaemonFECGui::on_controlPort_returnPressed()
sendControl(); sendControl();
} }
void SDRdaemonFECGui::on_dcOffset_toggled(bool checked) void SDRdaemonSourceGui::on_dcOffset_toggled(bool checked)
{ {
if (m_dcBlock != checked) if (m_dcBlock != checked)
{ {
@ -539,7 +539,7 @@ void SDRdaemonFECGui::on_dcOffset_toggled(bool checked)
} }
} }
void SDRdaemonFECGui::on_iqImbalance_toggled(bool checked) void SDRdaemonSourceGui::on_iqImbalance_toggled(bool checked)
{ {
if (m_iqCorrection != checked) if (m_iqCorrection != checked)
{ {
@ -548,19 +548,19 @@ void SDRdaemonFECGui::on_iqImbalance_toggled(bool checked)
} }
} }
void SDRdaemonFECGui::on_freq_changed(quint64 value) void SDRdaemonSourceGui::on_freq_changed(quint64 value)
{ {
m_settings.m_centerFrequency = value * 1000; m_settings.m_centerFrequency = value * 1000;
sendControl(); sendControl();
} }
void SDRdaemonFECGui::on_sampleRate_changed(quint64 value) void SDRdaemonSourceGui::on_sampleRate_changed(quint64 value)
{ {
m_settings.m_sampleRate = value; m_settings.m_sampleRate = value;
sendControl(); sendControl();
} }
void SDRdaemonFECGui::on_specificParms_returnPressed() void SDRdaemonSourceGui::on_specificParms_returnPressed()
{ {
if ((ui->specificParms->text()).size() > 0) { if ((ui->specificParms->text()).size() > 0) {
m_settings.m_specificParameters = ui->specificParms->text(); m_settings.m_specificParameters = ui->specificParms->text();
@ -568,19 +568,19 @@ void SDRdaemonFECGui::on_specificParms_returnPressed()
} }
} }
void SDRdaemonFECGui::on_decim_currentIndexChanged(int index __attribute__((unused))) void SDRdaemonSourceGui::on_decim_currentIndexChanged(int index __attribute__((unused)))
{ {
m_settings.m_log2Decim = ui->decim->currentIndex(); m_settings.m_log2Decim = ui->decim->currentIndex();
sendControl(); sendControl();
} }
void SDRdaemonFECGui::on_fcPos_currentIndexChanged(int index __attribute__((unused))) void SDRdaemonSourceGui::on_fcPos_currentIndexChanged(int index __attribute__((unused)))
{ {
m_settings.m_fcPos = ui->fcPos->currentIndex(); m_settings.m_fcPos = ui->fcPos->currentIndex();
sendControl(); sendControl();
} }
void SDRdaemonFECGui::on_txDelay_valueChanged(int value) void SDRdaemonSourceGui::on_txDelay_valueChanged(int value)
{ {
m_settings.m_txDelay = value / 100.0; m_settings.m_txDelay = value / 100.0;
ui->txDelayText->setText(tr("%1").arg(value)); ui->txDelayText->setText(tr("%1").arg(value));
@ -588,7 +588,7 @@ void SDRdaemonFECGui::on_txDelay_valueChanged(int value)
sendControl(); sendControl();
} }
void SDRdaemonFECGui::on_nbFECBlocks_valueChanged(int value) void SDRdaemonSourceGui::on_nbFECBlocks_valueChanged(int value)
{ {
m_settings.m_nbFECBlocks = value; m_settings.m_nbFECBlocks = value;
QString nstr = QString("%1").arg(m_settings.m_nbFECBlocks, 2, 10, QChar('0')); QString nstr = QString("%1").arg(m_settings.m_nbFECBlocks, 2, 10, QChar('0'));
@ -596,7 +596,7 @@ void SDRdaemonFECGui::on_nbFECBlocks_valueChanged(int value)
sendControl(); sendControl();
} }
void SDRdaemonFECGui::on_startStop_toggled(bool checked) void SDRdaemonSourceGui::on_startStop_toggled(bool checked)
{ {
if (checked) if (checked)
{ {
@ -613,7 +613,7 @@ void SDRdaemonFECGui::on_startStop_toggled(bool checked)
} }
} }
void SDRdaemonFECGui::on_record_toggled(bool checked) void SDRdaemonSourceGui::on_record_toggled(bool checked)
{ {
if (checked) if (checked)
{ {
@ -627,7 +627,7 @@ void SDRdaemonFECGui::on_record_toggled(bool checked)
} }
} }
void SDRdaemonFECGui::on_eventCountsReset_clicked(bool checked __attribute__((unused))) void SDRdaemonSourceGui::on_eventCountsReset_clicked(bool checked __attribute__((unused)))
{ {
m_countUnrecoverable = 0; m_countUnrecoverable = 0;
m_countRecovered = 0; m_countRecovered = 0;
@ -636,7 +636,7 @@ void SDRdaemonFECGui::on_eventCountsReset_clicked(bool checked __attribute__((un
displayEventTimer(); displayEventTimer();
} }
void SDRdaemonFECGui::displayEventCounts() void SDRdaemonSourceGui::displayEventCounts()
{ {
QString nstr = QString("%1").arg(m_countUnrecoverable, 3, 10, QChar('0')); QString nstr = QString("%1").arg(m_countUnrecoverable, 3, 10, QChar('0'));
ui->eventUnrecText->setText(nstr); ui->eventUnrecText->setText(nstr);
@ -644,7 +644,7 @@ void SDRdaemonFECGui::displayEventCounts()
ui->eventRecText->setText(nstr); ui->eventRecText->setText(nstr);
} }
void SDRdaemonFECGui::displayEventTimer() void SDRdaemonSourceGui::displayEventTimer()
{ {
int elapsedTimeMillis = m_eventsTime.elapsed(); int elapsedTimeMillis = m_eventsTime.elapsed();
QTime recordLength(0, 0, 0, 0); QTime recordLength(0, 0, 0, 0);
@ -653,32 +653,32 @@ void SDRdaemonFECGui::displayEventTimer()
ui->eventCountsTimeText->setText(s_time); ui->eventCountsTimeText->setText(s_time);
} }
void SDRdaemonFECGui::configureUDPLink() void SDRdaemonSourceGui::configureUDPLink()
{ {
qDebug() << "SDRdaemonGui::configureUDPLink: " << m_settings.m_address.toStdString().c_str() qDebug() << "SDRdaemonGui::configureUDPLink: " << m_settings.m_address.toStdString().c_str()
<< " : " << m_settings.m_dataPort; << " : " << m_settings.m_dataPort;
SDRdaemonFECInput::MsgConfigureSDRdaemonUDPLink* message = SDRdaemonFECInput::MsgConfigureSDRdaemonUDPLink::create(m_settings.m_address, m_settings.m_dataPort); SDRdaemonSourceInput::MsgConfigureSDRdaemonUDPLink* message = SDRdaemonSourceInput::MsgConfigureSDRdaemonUDPLink::create(m_settings.m_address, m_settings.m_dataPort);
m_sampleSource->getInputMessageQueue()->push(message); m_sampleSource->getInputMessageQueue()->push(message);
} }
void SDRdaemonFECGui::configureAutoCorrections() void SDRdaemonSourceGui::configureAutoCorrections()
{ {
SDRdaemonFECInput::MsgConfigureSDRdaemonAutoCorr* message = SDRdaemonFECInput::MsgConfigureSDRdaemonAutoCorr::create(m_dcBlock, m_iqCorrection); SDRdaemonSourceInput::MsgConfigureSDRdaemonAutoCorr* message = SDRdaemonSourceInput::MsgConfigureSDRdaemonAutoCorr::create(m_dcBlock, m_iqCorrection);
m_sampleSource->getInputMessageQueue()->push(message); m_sampleSource->getInputMessageQueue()->push(message);
} }
void SDRdaemonFECGui::updateWithAcquisition() void SDRdaemonSourceGui::updateWithAcquisition()
{ {
} }
void SDRdaemonFECGui::updateWithStreamData() void SDRdaemonSourceGui::updateWithStreamData()
{ {
ui->centerFrequency->setValue(m_centerFrequency / 1000); ui->centerFrequency->setValue(m_centerFrequency / 1000);
updateWithStreamTime(); updateWithStreamTime();
} }
void SDRdaemonFECGui::updateWithStreamTime() void SDRdaemonSourceGui::updateWithStreamTime()
{ {
bool updateEventCounts = false; bool updateEventCounts = false;
quint64 startingTimeStampMsec = ((quint64) m_startingTimeStamp.tv_sec * 1000LL) + ((quint64) m_startingTimeStamp.tv_usec / 1000LL); quint64 startingTimeStampMsec = ((quint64) m_startingTimeStamp.tv_sec * 1000LL) + ((quint64) m_startingTimeStamp.tv_usec / 1000LL);
@ -730,16 +730,16 @@ void SDRdaemonFECGui::updateWithStreamTime()
displayEventTimer(); displayEventTimer();
} }
void SDRdaemonFECGui::updateHardware() void SDRdaemonSourceGui::updateHardware()
{ {
qDebug() << "SDRdaemonSinkGui::updateHardware"; qDebug() << "SDRdaemonSinkGui::updateHardware";
SDRdaemonFECInput::MsgConfigureSDRdaemonFEC* message = SDRdaemonFECInput::MsgConfigureSDRdaemonFEC::create(m_settings, m_forceSettings); SDRdaemonSourceInput::MsgConfigureSDRdaemonSource* message = SDRdaemonSourceInput::MsgConfigureSDRdaemonSource::create(m_settings, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message); m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false; m_forceSettings = false;
m_updateTimer.stop(); m_updateTimer.stop();
} }
void SDRdaemonFECGui::updateStatus() void SDRdaemonSourceGui::updateStatus()
{ {
int state = m_deviceAPI->state(); int state = m_deviceAPI->state();
@ -768,10 +768,10 @@ void SDRdaemonFECGui::updateStatus()
} }
} }
void SDRdaemonFECGui::tick() void SDRdaemonSourceGui::tick()
{ {
if ((++m_tickCount & 0xf) == 0) { if ((++m_tickCount & 0xf) == 0) {
SDRdaemonFECInput::MsgConfigureSDRdaemonStreamTiming* message = SDRdaemonFECInput::MsgConfigureSDRdaemonStreamTiming::create(); SDRdaemonSourceInput::MsgConfigureSDRdaemonStreamTiming* message = SDRdaemonSourceInput::MsgConfigureSDRdaemonStreamTiming::create();
m_sampleSource->getInputMessageQueue()->push(message); m_sampleSource->getInputMessageQueue()->push(message);
} }
} }

View File

@ -30,12 +30,12 @@ namespace Ui {
class SDRdaemonSourceGui; class SDRdaemonSourceGui;
} }
class SDRdaemonFECGui : public QWidget, public PluginGUI { class SDRdaemonSourceGui : public QWidget, public PluginGUI {
Q_OBJECT Q_OBJECT
public: public:
explicit SDRdaemonFECGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL); explicit SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~SDRdaemonFECGui(); virtual ~SDRdaemonSourceGui();
void destroy(); void destroy();
void setName(const QString& name); void setName(const QString& name);
@ -52,8 +52,8 @@ private:
Ui::SDRdaemonSourceGui* ui; Ui::SDRdaemonSourceGui* ui;
DeviceSourceAPI* m_deviceAPI; DeviceSourceAPI* m_deviceAPI;
SDRdaemonFECSettings m_settings; //!< current settings SDRdaemonSourceSettings m_settings; //!< current settings
SDRdaemonFECSettings m_controlSettings; //!< settings last sent to device via control port SDRdaemonSourceSettings m_controlSettings; //!< settings last sent to device via control port
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer; QTimer m_statusTimer;
DeviceSampleSource* m_sampleSource; DeviceSampleSource* m_sampleSource;

View File

@ -28,16 +28,16 @@
#include "sdrdaemonsourceinput.h" #include "sdrdaemonsourceinput.h"
#include "sdrdaemonsourceudphandler.h" #include "sdrdaemonsourceudphandler.h"
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgConfigureSDRdaemonFEC, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgConfigureSDRdaemonSource, Message)
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgConfigureSDRdaemonUDPLink, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgConfigureSDRdaemonUDPLink, Message)
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgConfigureSDRdaemonAutoCorr, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgConfigureSDRdaemonAutoCorr, Message)
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgConfigureSDRdaemonWork, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgConfigureSDRdaemonWork, Message)
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgConfigureSDRdaemonStreamTiming, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgConfigureSDRdaemonStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgReportSDRdaemonAcquisition, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgReportSDRdaemonAcquisition, Message)
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming, Message)
SDRdaemonFECInput::SDRdaemonFECInput(const QTimer& masterTimer, DeviceSourceAPI *deviceAPI) : SDRdaemonSourceInput::SDRdaemonSourceInput(const QTimer& masterTimer, DeviceSourceAPI *deviceAPI) :
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_address("127.0.0.1"), m_address("127.0.0.1"),
m_port(9090), m_port(9090),
@ -51,17 +51,17 @@ SDRdaemonFECInput::SDRdaemonFECInput(const QTimer& masterTimer, DeviceSourceAPI
m_autoCorrBuffer(false) m_autoCorrBuffer(false)
{ {
m_sampleFifo.setSize(96000 * 4); m_sampleFifo.setSize(96000 * 4);
m_SDRdaemonUDPHandler = new SDRdaemonFECUDPHandler(&m_sampleFifo, getOutputMessageQueueToGUI(), m_deviceAPI); m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, getOutputMessageQueueToGUI(), m_deviceAPI);
m_SDRdaemonUDPHandler->connectTimer(&m_masterTimer); m_SDRdaemonUDPHandler->connectTimer(&m_masterTimer);
} }
SDRdaemonFECInput::~SDRdaemonFECInput() SDRdaemonSourceInput::~SDRdaemonSourceInput()
{ {
stop(); stop();
delete m_SDRdaemonUDPHandler; delete m_SDRdaemonUDPHandler;
} }
bool SDRdaemonFECInput::start() bool SDRdaemonSourceInput::start()
{ {
qDebug() << "SDRdaemonInput::start"; qDebug() << "SDRdaemonInput::start";
MsgConfigureSDRdaemonWork *command = MsgConfigureSDRdaemonWork::create(true); MsgConfigureSDRdaemonWork *command = MsgConfigureSDRdaemonWork::create(true);
@ -69,34 +69,34 @@ bool SDRdaemonFECInput::start()
return true; return true;
} }
void SDRdaemonFECInput::stop() void SDRdaemonSourceInput::stop()
{ {
qDebug() << "SDRdaemonInput::stop"; qDebug() << "SDRdaemonInput::stop";
MsgConfigureSDRdaemonWork *command = MsgConfigureSDRdaemonWork::create(false); MsgConfigureSDRdaemonWork *command = MsgConfigureSDRdaemonWork::create(false);
getInputMessageQueue()->push(command); getInputMessageQueue()->push(command);
} }
const QString& SDRdaemonFECInput::getDeviceDescription() const const QString& SDRdaemonSourceInput::getDeviceDescription() const
{ {
return m_deviceDescription; return m_deviceDescription;
} }
int SDRdaemonFECInput::getSampleRate() const int SDRdaemonSourceInput::getSampleRate() const
{ {
return m_sampleRate; return m_sampleRate;
} }
quint64 SDRdaemonFECInput::getCenterFrequency() const quint64 SDRdaemonSourceInput::getCenterFrequency() const
{ {
return m_centerFrequency; return m_centerFrequency;
} }
std::time_t SDRdaemonFECInput::getStartingTimeStamp() const std::time_t SDRdaemonSourceInput::getStartingTimeStamp() const
{ {
return m_startingTimeStamp; return m_startingTimeStamp;
} }
void SDRdaemonFECInput::getRemoteAddress(QString &s) void SDRdaemonSourceInput::getRemoteAddress(QString &s)
{ {
if (m_SDRdaemonUDPHandler) { if (m_SDRdaemonUDPHandler) {
m_SDRdaemonUDPHandler->getRemoteAddress(s); m_SDRdaemonUDPHandler->getRemoteAddress(s);
@ -104,9 +104,9 @@ void SDRdaemonFECInput::getRemoteAddress(QString &s)
} }
bool SDRdaemonFECInput::handleMessage(const Message& message) bool SDRdaemonSourceInput::handleMessage(const Message& message)
{ {
if (MsgConfigureSDRdaemonFEC::match(message)) if (MsgConfigureSDRdaemonSource::match(message))
{ {
qDebug() << "SDRdaemonFECInput::handleMessage:" << message.getIdentifier(); qDebug() << "SDRdaemonFECInput::handleMessage:" << message.getIdentifier();
//MsgConfigureSDRdaemonFEC& conf = (MsgConfigureSDRdaemonFEC&) message; //MsgConfigureSDRdaemonFEC& conf = (MsgConfigureSDRdaemonFEC&) message;

View File

@ -27,27 +27,27 @@
#include "sdrdaemonsourcesettings.h" #include "sdrdaemonsourcesettings.h"
class DeviceSourceAPI; class DeviceSourceAPI;
class SDRdaemonFECUDPHandler; class SDRdaemonSourceUDPHandler;
class SDRdaemonFECInput : public DeviceSampleSource { class SDRdaemonSourceInput : public DeviceSampleSource {
public: public:
class MsgConfigureSDRdaemonFEC : public Message { class MsgConfigureSDRdaemonSource : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
const SDRdaemonFECSettings& getSettings() const { return m_settings; } const SDRdaemonSourceSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; } bool getForce() const { return m_force; }
static MsgConfigureSDRdaemonFEC* create(const SDRdaemonFECSettings& settings, bool force = false) static MsgConfigureSDRdaemonSource* create(const SDRdaemonSourceSettings& settings, bool force = false)
{ {
return new MsgConfigureSDRdaemonFEC(settings, force); return new MsgConfigureSDRdaemonSource(settings, force);
} }
private: private:
SDRdaemonFECSettings m_settings; SDRdaemonSourceSettings m_settings;
bool m_force; bool m_force;
MsgConfigureSDRdaemonFEC(const SDRdaemonFECSettings& settings, bool force) : MsgConfigureSDRdaemonSource(const SDRdaemonSourceSettings& settings, bool force) :
Message(), Message(),
m_settings(settings), m_settings(settings),
m_force(force) m_force(force)
@ -156,7 +156,7 @@ public:
{ } { }
}; };
class MsgReportSDRdaemonFECStreamData : public Message { class MsgReportSDRdaemonSourceStreamData : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
@ -165,9 +165,9 @@ public:
uint32_t get_tv_sec() const { return m_tv_sec; } uint32_t get_tv_sec() const { return m_tv_sec; }
uint32_t get_tv_usec() const { return m_tv_usec; } uint32_t get_tv_usec() const { return m_tv_usec; }
static MsgReportSDRdaemonFECStreamData* create(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec) static MsgReportSDRdaemonSourceStreamData* create(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec)
{ {
return new MsgReportSDRdaemonFECStreamData(sampleRate, centerFrequency, tv_sec, tv_usec); return new MsgReportSDRdaemonSourceStreamData(sampleRate, centerFrequency, tv_sec, tv_usec);
} }
protected: protected:
@ -176,7 +176,7 @@ public:
uint32_t m_tv_sec; uint32_t m_tv_sec;
uint32_t m_tv_usec; uint32_t m_tv_usec;
MsgReportSDRdaemonFECStreamData(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec) : MsgReportSDRdaemonSourceStreamData(int sampleRate, quint64 centerFrequency, uint32_t tv_sec, uint32_t tv_usec) :
Message(), Message(),
m_sampleRate(sampleRate), m_sampleRate(sampleRate),
m_centerFrequency(centerFrequency), m_centerFrequency(centerFrequency),
@ -185,7 +185,7 @@ public:
{ } { }
}; };
class MsgReportSDRdaemonFECStreamTiming : public Message { class MsgReportSDRdaemonSourceStreamTiming : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
@ -204,7 +204,7 @@ public:
int getNbOriginalBlocksPerFrame() const { return m_nbOriginalBlocksPerFrame; } int getNbOriginalBlocksPerFrame() const { return m_nbOriginalBlocksPerFrame; }
int getNbFECBlocksPerFrame() const { return m_nbFECBlocksPerFrame; } int getNbFECBlocksPerFrame() const { return m_nbFECBlocksPerFrame; }
static MsgReportSDRdaemonFECStreamTiming* create(uint32_t tv_sec, static MsgReportSDRdaemonSourceStreamTiming* create(uint32_t tv_sec,
uint32_t tv_usec, uint32_t tv_usec,
float bufferLenSec, float bufferLenSec,
int32_t bufferGauge, int32_t bufferGauge,
@ -219,7 +219,7 @@ public:
int nbOriginalBlocksPerFrame, int nbOriginalBlocksPerFrame,
int nbFECBlocksPerFrame) int nbFECBlocksPerFrame)
{ {
return new MsgReportSDRdaemonFECStreamTiming(tv_sec, return new MsgReportSDRdaemonSourceStreamTiming(tv_sec,
tv_usec, tv_usec,
bufferLenSec, bufferLenSec,
bufferGauge, bufferGauge,
@ -251,7 +251,7 @@ public:
int m_nbOriginalBlocksPerFrame; int m_nbOriginalBlocksPerFrame;
int m_nbFECBlocksPerFrame; int m_nbFECBlocksPerFrame;
MsgReportSDRdaemonFECStreamTiming(uint32_t tv_sec, MsgReportSDRdaemonSourceStreamTiming(uint32_t tv_sec,
uint32_t tv_usec, uint32_t tv_usec,
float bufferLenSec, float bufferLenSec,
int32_t bufferGauge, int32_t bufferGauge,
@ -283,8 +283,8 @@ public:
{ } { }
}; };
SDRdaemonFECInput(const QTimer& masterTimer, DeviceSourceAPI *deviceAPI); SDRdaemonSourceInput(const QTimer& masterTimer, DeviceSourceAPI *deviceAPI);
virtual ~SDRdaemonFECInput(); virtual ~SDRdaemonSourceInput();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();
@ -302,7 +302,7 @@ private:
QMutex m_mutex; QMutex m_mutex;
QString m_address; QString m_address;
quint16 m_port; quint16 m_port;
SDRdaemonFECUDPHandler* m_SDRdaemonUDPHandler; SDRdaemonSourceUDPHandler* m_SDRdaemonUDPHandler;
QString m_deviceDescription; QString m_deviceDescription;
int m_sampleRate; int m_sampleRate;
quint64 m_centerFrequency; quint64 m_centerFrequency;

View File

@ -24,8 +24,8 @@
#include "sdrdaemonsourcegui.h" #include "sdrdaemonsourcegui.h"
#include "sdrdaemonsourceplugin.h" #include "sdrdaemonsourceplugin.h"
const PluginDescriptor SDRdaemonFECPlugin::m_pluginDescriptor = { const PluginDescriptor SDRdaemonSourcePlugin::m_pluginDescriptor = {
QString("SDRdaemon with FEC input"), QString("SDRdaemon source input"),
QString("3.5.0"), QString("3.5.0"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
@ -33,32 +33,32 @@ const PluginDescriptor SDRdaemonFECPlugin::m_pluginDescriptor = {
QString("https://github.com/f4exb/sdrangel") QString("https://github.com/f4exb/sdrangel")
}; };
const QString SDRdaemonFECPlugin::m_hardwareID = "SDRdaemonFEC"; const QString SDRdaemonSourcePlugin::m_hardwareID = "SDRdaemonSource";
const QString SDRdaemonFECPlugin::m_deviceTypeID = SDRDAEMONFEC_DEVICE_TYPE_ID; const QString SDRdaemonSourcePlugin::m_deviceTypeID = SDRDAEMONSOURCE_DEVICE_TYPE_ID;
SDRdaemonFECPlugin::SDRdaemonFECPlugin(QObject* parent) : SDRdaemonSourcePlugin::SDRdaemonSourcePlugin(QObject* parent) :
QObject(parent) QObject(parent)
{ {
} }
const PluginDescriptor& SDRdaemonFECPlugin::getPluginDescriptor() const const PluginDescriptor& SDRdaemonSourcePlugin::getPluginDescriptor() const
{ {
return m_pluginDescriptor; return m_pluginDescriptor;
} }
void SDRdaemonFECPlugin::initPlugin(PluginAPI* pluginAPI) void SDRdaemonSourcePlugin::initPlugin(PluginAPI* pluginAPI)
{ {
pluginAPI->registerSampleSource(m_deviceTypeID, this); pluginAPI->registerSampleSource(m_deviceTypeID, this);
} }
PluginInterface::SamplingDevices SDRdaemonFECPlugin::enumSampleSources() PluginInterface::SamplingDevices SDRdaemonSourcePlugin::enumSampleSources()
{ {
SamplingDevices result; SamplingDevices result;
int count = 1; int count = 1;
for(int i = 0; i < count; i++) for(int i = 0; i < count; i++)
{ {
QString displayedName(QString("SDRdaemonFEC[%1]").arg(i)); QString displayedName(QString("SDRdaemonSource[%1]").arg(i));
result.append(SamplingDevice(displayedName, result.append(SamplingDevice(displayedName,
m_hardwareID, m_hardwareID,
@ -70,11 +70,11 @@ PluginInterface::SamplingDevices SDRdaemonFECPlugin::enumSampleSources()
return result; return result;
} }
PluginGUI* SDRdaemonFECPlugin::createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI) PluginGUI* SDRdaemonSourcePlugin::createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI)
{ {
if(sourceId == m_deviceTypeID) if(sourceId == m_deviceTypeID)
{ {
SDRdaemonFECGui* gui = new SDRdaemonFECGui(deviceAPI); SDRdaemonSourceGui* gui = new SDRdaemonSourceGui(deviceAPI);
*widget = gui; *widget = gui;
return gui; return gui;
} }

View File

@ -20,17 +20,17 @@
#include <QObject> #include <QObject>
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
#define SDRDAEMONFEC_DEVICE_TYPE_ID "sdrangel.samplesource.sdrdaemonfec" #define SDRDAEMONSOURCE_DEVICE_TYPE_ID "sdrangel.samplesource.sdrdaemonsource"
class PluginAPI; class PluginAPI;
class SDRdaemonFECPlugin : public QObject, public PluginInterface { class SDRdaemonSourcePlugin : public QObject, public PluginInterface {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID SDRDAEMONFEC_DEVICE_TYPE_ID) Q_PLUGIN_METADATA(IID SDRDAEMONSOURCE_DEVICE_TYPE_ID)
public: public:
explicit SDRdaemonFECPlugin(QObject* parent = NULL); explicit SDRdaemonSourcePlugin(QObject* parent = NULL);
const PluginDescriptor& getPluginDescriptor() const; const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI);

View File

@ -17,12 +17,12 @@
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
#include "sdrdaemonsourcesettings.h" #include "sdrdaemonsourcesettings.h"
SDRdaemonFECSettings::SDRdaemonFECSettings() SDRdaemonSourceSettings::SDRdaemonSourceSettings()
{ {
resetToDefaults(); resetToDefaults();
} }
void SDRdaemonFECSettings::resetToDefaults() void SDRdaemonSourceSettings::resetToDefaults()
{ {
m_centerFrequency = 435000*1000; m_centerFrequency = 435000*1000;
m_sampleRate = 256000; m_sampleRate = 256000;
@ -38,7 +38,7 @@ void SDRdaemonFECSettings::resetToDefaults()
m_fcPos = 2; // center m_fcPos = 2; // center
} }
QByteArray SDRdaemonFECSettings::serialize() const QByteArray SDRdaemonSourceSettings::serialize() const
{ {
SimpleSerializer s(1); SimpleSerializer s(1);
@ -57,7 +57,7 @@ QByteArray SDRdaemonFECSettings::serialize() const
return s.final(); return s.final();
} }
bool SDRdaemonFECSettings::deserialize(const QByteArray& data) bool SDRdaemonSourceSettings::deserialize(const QByteArray& data)
{ {
SimpleDeserializer d(data); SimpleDeserializer d(data);

View File

@ -20,7 +20,7 @@
#include <QByteArray> #include <QByteArray>
#include <QString> #include <QString>
struct SDRdaemonFECSettings { struct SDRdaemonSourceSettings {
quint64 m_centerFrequency; quint64 m_centerFrequency;
quint64 m_sampleRate; quint64 m_sampleRate;
quint32 m_log2Decim; quint32 m_log2Decim;
@ -34,7 +34,7 @@ struct SDRdaemonFECSettings {
bool m_iqCorrection; bool m_iqCorrection;
quint32 m_fcPos; quint32 m_fcPos;
SDRdaemonFECSettings(); SDRdaemonSourceSettings();
void resetToDefaults(); void resetToDefaults();
QByteArray serialize() const; QByteArray serialize() const;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data);

View File

@ -26,7 +26,7 @@
#include "sdrdaemonsourceinput.h" #include "sdrdaemonsourceinput.h"
#include "sdrdaemonsourceudphandler.h" #include "sdrdaemonsourceudphandler.h"
SDRdaemonFECUDPHandler::SDRdaemonFECUDPHandler(SampleSinkFifo *sampleFifo, MessageQueue *outputMessageQueueToGUI, DeviceSourceAPI *devieAPI) : SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo, MessageQueue *outputMessageQueueToGUI, DeviceSourceAPI *devieAPI) :
m_deviceAPI(devieAPI), m_deviceAPI(devieAPI),
m_sdrDaemonBuffer(m_rateDivider), m_sdrDaemonBuffer(m_rateDivider),
m_dataSocket(0), m_dataSocket(0),
@ -45,17 +45,17 @@ SDRdaemonFECUDPHandler::SDRdaemonFECUDPHandler(SampleSinkFifo *sampleFifo, Messa
m_tickCount(0), m_tickCount(0),
m_samplesCount(0), m_samplesCount(0),
m_timer(0), m_timer(0),
m_throttlems(SDRDAEMONFEC_THROTTLE_MS), m_throttlems(SDRDAEMONSOURCE_THROTTLE_MS),
m_readLengthSamples(0), m_readLengthSamples(0),
m_readLength(0), m_readLength(0),
m_throttleToggle(false), m_throttleToggle(false),
m_rateDivider(1000/SDRDAEMONFEC_THROTTLE_MS), m_rateDivider(1000/SDRDAEMONSOURCE_THROTTLE_MS),
m_autoCorrBuffer(true) m_autoCorrBuffer(true)
{ {
m_udpBuf = new char[SDRdaemonFECBuffer::m_udpPayloadSize]; m_udpBuf = new char[SDRdaemonSourceBuffer::m_udpPayloadSize];
} }
SDRdaemonFECUDPHandler::~SDRdaemonFECUDPHandler() SDRdaemonSourceUDPHandler::~SDRdaemonSourceUDPHandler()
{ {
stop(); stop();
delete[] m_udpBuf; delete[] m_udpBuf;
@ -66,7 +66,7 @@ SDRdaemonFECUDPHandler::~SDRdaemonFECUDPHandler()
#endif #endif
} }
void SDRdaemonFECUDPHandler::start() void SDRdaemonSourceUDPHandler::start()
{ {
qDebug("SDRdaemonFECUDPHandler::start"); qDebug("SDRdaemonFECUDPHandler::start");
@ -98,7 +98,7 @@ void SDRdaemonFECUDPHandler::start()
m_elapsedTimer.start(); m_elapsedTimer.start();
} }
void SDRdaemonFECUDPHandler::stop() void SDRdaemonSourceUDPHandler::stop()
{ {
qDebug("SDRdaemonFECUDPHandler::stop"); qDebug("SDRdaemonFECUDPHandler::stop");
@ -115,7 +115,7 @@ void SDRdaemonFECUDPHandler::stop()
} }
} }
void SDRdaemonFECUDPHandler::configureUDPLink(const QString& address, quint16 port) void SDRdaemonSourceUDPHandler::configureUDPLink(const QString& address, quint16 port)
{ {
qDebug("SDRdaemonFECUDPHandler::configureUDPLink: %s:%d", address.toStdString().c_str(), port); qDebug("SDRdaemonFECUDPHandler::configureUDPLink: %s:%d", address.toStdString().c_str(), port);
bool addressOK = m_dataAddress.setAddress(address); bool addressOK = m_dataAddress.setAddress(address);
@ -131,7 +131,7 @@ void SDRdaemonFECUDPHandler::configureUDPLink(const QString& address, quint16 po
start(); start();
} }
void SDRdaemonFECUDPHandler::dataReadyRead() void SDRdaemonSourceUDPHandler::dataReadyRead()
{ {
m_udpReadBytes = 0; m_udpReadBytes = 0;
@ -140,17 +140,17 @@ void SDRdaemonFECUDPHandler::dataReadyRead()
qint64 pendingDataSize = m_dataSocket->pendingDatagramSize(); qint64 pendingDataSize = m_dataSocket->pendingDatagramSize();
m_udpReadBytes += m_dataSocket->readDatagram(&m_udpBuf[m_udpReadBytes], pendingDataSize, &m_remoteAddress, 0); m_udpReadBytes += m_dataSocket->readDatagram(&m_udpBuf[m_udpReadBytes], pendingDataSize, &m_remoteAddress, 0);
if (m_udpReadBytes == SDRdaemonFECBuffer::m_udpPayloadSize) { if (m_udpReadBytes == SDRdaemonSourceBuffer::m_udpPayloadSize) {
processData(); processData();
m_udpReadBytes = 0; m_udpReadBytes = 0;
} }
} }
} }
void SDRdaemonFECUDPHandler::processData() void SDRdaemonSourceUDPHandler::processData()
{ {
m_sdrDaemonBuffer.writeData(m_udpBuf); m_sdrDaemonBuffer.writeData(m_udpBuf);
const SDRdaemonFECBuffer::MetaDataFEC& metaData = m_sdrDaemonBuffer.getCurrentMeta(); const SDRdaemonSourceBuffer::MetaDataFEC& metaData = m_sdrDaemonBuffer.getCurrentMeta();
bool change = false; bool change = false;
// m_tv_sec = metaData.m_tv_sec; // m_tv_sec = metaData.m_tv_sec;
@ -174,7 +174,7 @@ void SDRdaemonFECUDPHandler::processData()
{ {
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine
m_deviceAPI->getDeviceInputMessageQueue()->push(notif); m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData *report = SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData::create( SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData::create(
m_samplerate, m_samplerate,
m_centerFrequency * 1000, // Frequency in Hz for the GUI m_centerFrequency * 1000, // Frequency in Hz for the GUI
m_tv_sec, m_tv_sec,
@ -183,7 +183,7 @@ void SDRdaemonFECUDPHandler::processData()
} }
} }
void SDRdaemonFECUDPHandler::connectTimer(const QTimer* timer) void SDRdaemonSourceUDPHandler::connectTimer(const QTimer* timer)
{ {
qDebug() << "SDRdaemonFECUDPHandler::connectTimer"; qDebug() << "SDRdaemonFECUDPHandler::connectTimer";
#ifdef USE_INTERNAL_TIMER #ifdef USE_INTERNAL_TIMER
@ -199,7 +199,7 @@ void SDRdaemonFECUDPHandler::connectTimer(const QTimer* timer)
m_rateDivider = 1000 / m_throttlems; m_rateDivider = 1000 / m_throttlems;
} }
void SDRdaemonFECUDPHandler::tick() void SDRdaemonSourceUDPHandler::tick()
{ {
// auto throttling // auto throttling
int throttlems = m_elapsedTimer.restart(); int throttlems = m_elapsedTimer.restart();
@ -215,7 +215,7 @@ void SDRdaemonFECUDPHandler::tick()
m_readLengthSamples += m_sdrDaemonBuffer.getRWBalanceCorrection(); m_readLengthSamples += m_sdrDaemonBuffer.getRWBalanceCorrection();
} }
m_readLength = m_readLengthSamples * SDRdaemonFECBuffer::m_iqSampleSize; m_readLength = m_readLengthSamples * SDRdaemonSourceBuffer::m_iqSampleSize;
// read samples directly feeding the SampleFifo (no callback) // read samples directly feeding the SampleFifo (no callback)
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength); m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
@ -243,7 +243,7 @@ void SDRdaemonFECUDPHandler::tick()
framesDecodingStatus = 2; framesDecodingStatus = 2;
} }
SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming *report = SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming::create( SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamTiming::create(
m_tv_sec, m_tv_sec,
m_tv_usec, m_tv_usec,
m_sdrDaemonBuffer.getBufferLengthInSecs(), m_sdrDaemonBuffer.getBufferLengthInSecs(),

View File

@ -25,31 +25,31 @@
#include "sdrdaemonsourcebuffer.h" #include "sdrdaemonsourcebuffer.h"
#define SDRDAEMONFEC_THROTTLE_MS 50 #define SDRDAEMONSOURCE_THROTTLE_MS 50
class SampleSinkFifo; class SampleSinkFifo;
class MessageQueue; class MessageQueue;
class QTimer; class QTimer;
class DeviceSourceAPI; class DeviceSourceAPI;
class SDRdaemonFECUDPHandler : public QObject class SDRdaemonSourceUDPHandler : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
SDRdaemonFECUDPHandler(SampleSinkFifo* sampleFifo, MessageQueue *outputMessageQueueToGUI, DeviceSourceAPI *deviceAPI); SDRdaemonSourceUDPHandler(SampleSinkFifo* sampleFifo, MessageQueue *outputMessageQueueToGUI, DeviceSourceAPI *deviceAPI);
~SDRdaemonFECUDPHandler(); ~SDRdaemonSourceUDPHandler();
void connectTimer(const QTimer* timer); void connectTimer(const QTimer* timer);
void start(); void start();
void stop(); void stop();
void configureUDPLink(const QString& address, quint16 port); void configureUDPLink(const QString& address, quint16 port);
void getRemoteAddress(QString& s) const { s = m_remoteAddress.toString(); } void getRemoteAddress(QString& s) const { s = m_remoteAddress.toString(); }
int getNbOriginalBlocks() const { return SDRdaemonFECBuffer::m_nbOriginalBlocks; } int getNbOriginalBlocks() const { return SDRdaemonSourceBuffer::m_nbOriginalBlocks; }
public slots: public slots:
void dataReadyRead(); void dataReadyRead();
private: private:
DeviceSourceAPI *m_deviceAPI; DeviceSourceAPI *m_deviceAPI;
SDRdaemonFECBuffer m_sdrDaemonBuffer; SDRdaemonSourceBuffer m_sdrDaemonBuffer;
QUdpSocket *m_dataSocket; QUdpSocket *m_dataSocket;
QHostAddress m_dataAddress; QHostAddress m_dataAddress;
QHostAddress m_remoteAddress; QHostAddress m_remoteAddress;