1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00

RxTx semantic move: renaming attributes (1). Corrected Star UML model

This commit is contained in:
f4exb 2016-10-04 01:49:28 +02:00
parent e204efe2b8
commit 9a24a1a99f
6 changed files with 8272 additions and 4149 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,9 +30,9 @@ DSPDeviceSourceEngine::DSPDeviceSourceEngine(uint uid, QObject* parent) :
m_uid(uid), m_uid(uid),
QThread(parent), QThread(parent),
m_state(StNotStarted), m_state(StNotStarted),
m_sampleSource(0), m_deviceSampleSource(0),
m_sampleSourceSequence(0), m_sampleSourceSequence(0),
m_sampleSinks(), m_basebandSampleSinks(),
m_sampleRate(0), m_sampleRate(0),
m_centerFrequency(0), m_centerFrequency(0),
m_dcOffsetCorrection(false), m_dcOffsetCorrection(false),
@ -242,7 +242,7 @@ void DSPDeviceSourceEngine::imbalance(SampleVector::iterator begin, SampleVector
void DSPDeviceSourceEngine::work() void DSPDeviceSourceEngine::work()
{ {
SampleFifo* sampleFifo = m_sampleSource->getSampleFifo(); SampleFifo* sampleFifo = m_deviceSampleSource->getSampleFifo();
std::size_t samplesDone = 0; std::size_t samplesDone = 0;
bool positiveOnly = false; bool positiveOnly = false;
@ -270,13 +270,13 @@ void DSPDeviceSourceEngine::work()
} }
// feed data to direct sinks // feed data to direct sinks
for (SampleSinks::const_iterator it = m_sampleSinks.begin(); it != m_sampleSinks.end(); ++it) for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); ++it)
{ {
(*it)->feed(part1begin, part1end, positiveOnly); (*it)->feed(part1begin, part1end, positiveOnly);
} }
// feed data to threaded sinks // feed data to threaded sinks
for (ThreadedSampleSinks::const_iterator it = m_threadedSampleSinks.begin(); it != m_threadedSampleSinks.end(); ++it) for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
{ {
(*it)->feed(part1begin, part1end, positiveOnly); (*it)->feed(part1begin, part1end, positiveOnly);
} }
@ -297,13 +297,13 @@ void DSPDeviceSourceEngine::work()
} }
// feed data to direct sinks // feed data to direct sinks
for (SampleSinks::const_iterator it = m_sampleSinks.begin(); it != m_sampleSinks.end(); it++) for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
{ {
(*it)->feed(part2begin, part2end, positiveOnly); (*it)->feed(part2begin, part2end, positiveOnly);
} }
// feed data to threaded sinks // feed data to threaded sinks
for (ThreadedSampleSinks::const_iterator it = m_threadedSampleSinks.begin(); it != m_threadedSampleSinks.end(); ++it) for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
{ {
(*it)->feed(part2begin, part2end, positiveOnly); (*it)->feed(part2begin, part2end, positiveOnly);
} }
@ -336,19 +336,19 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoIdle()
break; break;
} }
if(m_sampleSource == 0) if(m_deviceSampleSource == 0)
{ {
return StIdle; return StIdle;
} }
// stop everything // stop everything
for(SampleSinks::const_iterator it = m_sampleSinks.begin(); it != m_sampleSinks.end(); it++) for(BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
{ {
(*it)->stop(); (*it)->stop();
} }
m_sampleSource->stop(); m_deviceSampleSource->stop();
m_deviceDescription.clear(); m_deviceDescription.clear();
m_sampleRate = 0; m_sampleRate = 0;
@ -374,7 +374,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
break; break;
} }
if (m_sampleSource == 0) if (m_deviceSampleSource == 0)
{ {
return gotoError("No sample source configured"); return gotoError("No sample source configured");
} }
@ -386,9 +386,9 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
m_iRange = 1 << 16; m_iRange = 1 << 16;
m_qRange = 1 << 16; m_qRange = 1 << 16;
m_deviceDescription = m_sampleSource->getDeviceDescription(); m_deviceDescription = m_deviceSampleSource->getDeviceDescription();
m_centerFrequency = m_sampleSource->getCenterFrequency(); m_centerFrequency = m_deviceSampleSource->getCenterFrequency();
m_sampleRate = m_sampleSource->getSampleRate(); m_sampleRate = m_deviceSampleSource->getSampleRate();
qDebug() << "DSPDeviceEngine::gotoInit: " << m_deviceDescription.toStdString().c_str() << ": " qDebug() << "DSPDeviceEngine::gotoInit: " << m_deviceDescription.toStdString().c_str() << ": "
<< " sampleRate: " << m_sampleRate << " sampleRate: " << m_sampleRate
@ -396,13 +396,13 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
DSPSignalNotification notif(m_sampleRate, m_centerFrequency); DSPSignalNotification notif(m_sampleRate, m_centerFrequency);
for (SampleSinks::const_iterator it = m_sampleSinks.begin(); it != m_sampleSinks.end(); ++it) for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); ++it)
{ {
qDebug() << "DSPDeviceEngine::gotoInit: initializing " << (*it)->objectName().toStdString().c_str(); qDebug() << "DSPDeviceEngine::gotoInit: initializing " << (*it)->objectName().toStdString().c_str();
(*it)->handleMessage(notif); (*it)->handleMessage(notif);
} }
for (ThreadedSampleSinks::const_iterator it = m_threadedSampleSinks.begin(); it != m_threadedSampleSinks.end(); ++it) for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
{ {
qDebug() << "DSPDeviceEngine::gotoInit: initializing ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")"; qDebug() << "DSPDeviceEngine::gotoInit: initializing ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
(*it)->handleSinkMessage(notif); (*it)->handleSinkMessage(notif);
@ -436,7 +436,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
break; break;
} }
if(m_sampleSource == NULL) { if(m_deviceSampleSource == NULL) {
return gotoError("DSPDeviceEngine::gotoRunning: No sample source configured"); return gotoError("DSPDeviceEngine::gotoRunning: No sample source configured");
} }
@ -444,18 +444,18 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
// Start everything // Start everything
if(!m_sampleSource->start(m_sampleSourceSequence)) if(!m_deviceSampleSource->start(m_sampleSourceSequence))
{ {
return gotoError("Could not start sample source"); return gotoError("Could not start sample source");
} }
for(SampleSinks::const_iterator it = m_sampleSinks.begin(); it != m_sampleSinks.end(); it++) for(BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
{ {
qDebug() << "DSPDeviceEngine::gotoRunning: starting " << (*it)->objectName().toStdString().c_str(); qDebug() << "DSPDeviceEngine::gotoRunning: starting " << (*it)->objectName().toStdString().c_str();
(*it)->start(); (*it)->start();
} }
for (ThreadedSampleSinks::const_iterator it = m_threadedSampleSinks.begin(); it != m_threadedSampleSinks.end(); ++it) for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
{ {
qDebug() << "DSPDeviceEngine::gotoRunning: starting ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")"; qDebug() << "DSPDeviceEngine::gotoRunning: starting ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
(*it)->start(); (*it)->start();
@ -485,12 +485,12 @@ void DSPDeviceSourceEngine::handleSetSource(DeviceSampleSource* source)
// disconnect(m_sampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData())); // disconnect(m_sampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()));
// } // }
m_sampleSource = source; m_deviceSampleSource = source;
if(m_sampleSource != 0) if(m_deviceSampleSource != 0)
{ {
qDebug("DSPDeviceEngine::handleSetSource: set %s", qPrintable(source->getDeviceDescription())); qDebug("DSPDeviceEngine::handleSetSource: set %s", qPrintable(source->getDeviceDescription()));
connect(m_sampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()), Qt::QueuedConnection); connect(m_deviceSampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()), Qt::QueuedConnection);
} }
else else
{ {
@ -549,7 +549,7 @@ void DSPDeviceSourceEngine::handleSynchronousMessages()
else if (DSPAddSink::match(*message)) else if (DSPAddSink::match(*message))
{ {
BasebandSampleSink* sink = ((DSPAddSink*) message)->getSampleSink(); BasebandSampleSink* sink = ((DSPAddSink*) message)->getSampleSink();
m_sampleSinks.push_back(sink); m_basebandSampleSinks.push_back(sink);
} }
else if (DSPRemoveSink::match(*message)) else if (DSPRemoveSink::match(*message))
{ {
@ -559,19 +559,19 @@ void DSPDeviceSourceEngine::handleSynchronousMessages()
sink->stop(); sink->stop();
} }
m_sampleSinks.remove(sink); m_basebandSampleSinks.remove(sink);
} }
else if (DSPAddThreadedSampleSink::match(*message)) else if (DSPAddThreadedSampleSink::match(*message))
{ {
ThreadedBasebandSampleSink *threadedSink = ((DSPAddThreadedSampleSink*) message)->getThreadedSampleSink(); ThreadedBasebandSampleSink *threadedSink = ((DSPAddThreadedSampleSink*) message)->getThreadedSampleSink();
m_threadedSampleSinks.push_back(threadedSink); m_threadedBasebandSampleSinks.push_back(threadedSink);
threadedSink->start(); threadedSink->start();
} }
else if (DSPRemoveThreadedSampleSink::match(*message)) else if (DSPRemoveThreadedSampleSink::match(*message))
{ {
ThreadedBasebandSampleSink* threadedSink = ((DSPRemoveThreadedSampleSink*) message)->getThreadedSampleSink(); ThreadedBasebandSampleSink* threadedSink = ((DSPRemoveThreadedSampleSink*) message)->getThreadedSampleSink();
threadedSink->stop(); threadedSink->stop();
m_threadedSampleSinks.remove(threadedSink); m_threadedBasebandSampleSinks.remove(threadedSink);
} }
m_syncMessenger.done(m_state); m_syncMessenger.done(m_state);
@ -622,13 +622,13 @@ void DSPDeviceSourceEngine::handleInputMessages()
// forward source changes to sinks with immediate execution // forward source changes to sinks with immediate execution
for(SampleSinks::const_iterator it = m_sampleSinks.begin(); it != m_sampleSinks.end(); it++) for(BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
{ {
qDebug() << "DSPDeviceEngine::handleInputMessages: forward message to " << (*it)->objectName().toStdString().c_str(); qDebug() << "DSPDeviceEngine::handleInputMessages: forward message to " << (*it)->objectName().toStdString().c_str();
(*it)->handleMessage(*message); (*it)->handleMessage(*message);
} }
for (ThreadedSampleSinks::const_iterator it = m_threadedSampleSinks.begin(); it != m_threadedSampleSinks.end(); ++it) for (ThreadedBasebandSampleSinks::const_iterator it = m_threadedBasebandSampleSinks.begin(); it != m_threadedBasebandSampleSinks.end(); ++it)
{ {
qDebug() << "DSPDeviceEngine::handleSourceMessages: forward message to ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")"; qDebug() << "DSPDeviceEngine::handleSourceMessages: forward message to ThreadedSampleSink(" << (*it)->getSampleSinkObjectName().toStdString().c_str() << ")";
(*it)->handleSinkMessage(*message); (*it)->handleSinkMessage(*message);

View File

@ -88,14 +88,14 @@ private:
QString m_errorMessage; QString m_errorMessage;
QString m_deviceDescription; QString m_deviceDescription;
DeviceSampleSource* m_sampleSource; DeviceSampleSource* m_deviceSampleSource;
int m_sampleSourceSequence; int m_sampleSourceSequence;
typedef std::list<BasebandSampleSink*> SampleSinks; typedef std::list<BasebandSampleSink*> BasebandSampleSinks;
SampleSinks m_sampleSinks; //!< sample sinks within main thread (usually spectrum, file output) BasebandSampleSinks m_basebandSampleSinks; //!< sample sinks within main thread (usually spectrum, file output)
typedef std::list<ThreadedBasebandSampleSink*> ThreadedSampleSinks; typedef std::list<ThreadedBasebandSampleSink*> ThreadedBasebandSampleSinks;
ThreadedSampleSinks m_threadedSampleSinks; //!< sample sinks on their own threads (usually channels) ThreadedBasebandSampleSinks m_threadedBasebandSampleSinks; //!< sample sinks on their own threads (usually channels)
uint m_sampleRate; uint m_sampleRate;
quint64 m_centerFrequency; quint64 m_centerFrequency;

View File

@ -64,18 +64,18 @@ void ThreadedBasebandSampleFifo::handleFifoData() // FIXME: Fixed? Move it to th
} }
ThreadedBasebandSampleSink::ThreadedBasebandSampleSink(BasebandSampleSink* sampleSink, QObject *parent) : ThreadedBasebandSampleSink::ThreadedBasebandSampleSink(BasebandSampleSink* sampleSink, QObject *parent) :
m_sampleSink(sampleSink) m_basebandSampleSink(sampleSink)
{ {
QString name = "ThreadedSampleSink(" + m_sampleSink->objectName() + ")"; QString name = "ThreadedSampleSink(" + m_basebandSampleSink->objectName() + ")";
setObjectName(name); setObjectName(name);
qDebug() << "ThreadedSampleSink::ThreadedSampleSink: " << name; qDebug() << "ThreadedSampleSink::ThreadedSampleSink: " << name;
m_thread = new QThread(parent); m_thread = new QThread(parent);
m_threadedSampleFifo = new ThreadedBasebandSampleFifo(m_sampleSink); m_threadedBasebandSampleFifo = new ThreadedBasebandSampleFifo(m_basebandSampleSink);
//moveToThread(m_thread); // FIXME: Fixed? the intermediate FIFO should be handled within the sink. Define a new type of sink that is compatible with threading //moveToThread(m_thread); // FIXME: Fixed? the intermediate FIFO should be handled within the sink. Define a new type of sink that is compatible with threading
m_sampleSink->moveToThread(m_thread); m_basebandSampleSink->moveToThread(m_thread);
m_threadedSampleFifo->moveToThread(m_thread); m_threadedBasebandSampleFifo->moveToThread(m_thread);
//m_sampleFifo.moveToThread(m_thread); //m_sampleFifo.moveToThread(m_thread);
//connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleData())); //connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleData()));
//m_sampleFifo.setSize(262144); //m_sampleFifo.setSize(262144);
@ -85,7 +85,7 @@ ThreadedBasebandSampleSink::ThreadedBasebandSampleSink(BasebandSampleSink* sampl
ThreadedBasebandSampleSink::~ThreadedBasebandSampleSink() ThreadedBasebandSampleSink::~ThreadedBasebandSampleSink()
{ {
delete m_threadedSampleFifo; // Valgrind memcheck delete m_threadedBasebandSampleFifo; // Valgrind memcheck
delete m_thread; delete m_thread;
} }
@ -93,13 +93,13 @@ void ThreadedBasebandSampleSink::start()
{ {
qDebug() << "ThreadedSampleSink::start"; qDebug() << "ThreadedSampleSink::start";
m_thread->start(); m_thread->start();
m_sampleSink->start(); m_basebandSampleSink->start();
} }
void ThreadedBasebandSampleSink::stop() void ThreadedBasebandSampleSink::stop()
{ {
qDebug() << "ThreadedSampleSink::stop"; qDebug() << "ThreadedSampleSink::stop";
m_sampleSink->stop(); m_basebandSampleSink->stop();
m_thread->exit(); m_thread->exit();
m_thread->wait(); m_thread->wait();
} }
@ -108,15 +108,15 @@ void ThreadedBasebandSampleSink::feed(SampleVector::const_iterator begin, Sample
{ {
//m_sampleSink->feed(begin, end, positiveOnly); //m_sampleSink->feed(begin, end, positiveOnly);
//m_sampleFifo.write(begin, end); //m_sampleFifo.write(begin, end);
m_threadedSampleFifo->writeToFifo(begin, end); m_threadedBasebandSampleFifo->writeToFifo(begin, end);
} }
bool ThreadedBasebandSampleSink::handleSinkMessage(const Message& cmd) bool ThreadedBasebandSampleSink::handleSinkMessage(const Message& cmd)
{ {
return m_sampleSink->handleMessage(cmd); return m_basebandSampleSink->handleMessage(cmd);
} }
QString ThreadedBasebandSampleSink::getSampleSinkObjectName() const QString ThreadedBasebandSampleSink::getSampleSinkObjectName() const
{ {
return m_sampleSink->objectName(); return m_basebandSampleSink->objectName();
} }

View File

@ -56,9 +56,9 @@ public:
ThreadedBasebandSampleSink(BasebandSampleSink* sampleSink, QObject *parent = 0); ThreadedBasebandSampleSink(BasebandSampleSink* sampleSink, QObject *parent = 0);
~ThreadedBasebandSampleSink(); ~ThreadedBasebandSampleSink();
const BasebandSampleSink *getSink() const { return m_sampleSink; } const BasebandSampleSink *getSink() const { return m_basebandSampleSink; }
MessageQueue* getInputMessageQueue() { return m_sampleSink->getInputMessageQueue(); } //!< Return pointer to sample sink's input message queue MessageQueue* getInputMessageQueue() { return m_basebandSampleSink->getInputMessageQueue(); } //!< Return pointer to sample sink's input message queue
MessageQueue* getOutputMessageQueue() { return m_sampleSink->getOutputMessageQueue(); } //!< Return pointer to sample sink's output message queue MessageQueue* getOutputMessageQueue() { return m_basebandSampleSink->getOutputMessageQueue(); } //!< Return pointer to sample sink's output message queue
void start(); //!< this thread start() void start(); //!< this thread start()
void stop(); //!< this thread exit() and wait() void stop(); //!< this thread exit() and wait()
@ -71,8 +71,8 @@ public:
protected: protected:
QThread *m_thread; //!< The thead object QThread *m_thread; //!< The thead object
ThreadedBasebandSampleFifo *m_threadedSampleFifo; ThreadedBasebandSampleFifo *m_threadedBasebandSampleFifo;
BasebandSampleSink* m_sampleSink; BasebandSampleSink* m_basebandSampleSink;
}; };
#endif // INCLUDE_THREADEDSAMPLESINK_H #endif // INCLUDE_THREADEDSAMPLESINK_H

View File

@ -13,7 +13,6 @@ class Preset;
class MainWindow; class MainWindow;
class Message; class Message;
class MessageQueue; class MessageQueue;
class DSPDeviceSourceEngine;
class DeviceAPI; class DeviceAPI;
class SDRANGEL_API PluginManager : public QObject { class SDRANGEL_API PluginManager : public QObject {