SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
|
#include <dspdevicesinkengine.h>
Inherits QThread.
Public Types | |
enum | State { StNotStarted, StIdle, StReady, StRunning, StError } |
Public Member Functions | |
DSPDeviceSinkEngine (uint32_t uid, QObject *parent=NULL) | |
~DSPDeviceSinkEngine () | |
uint32_t | getUID () const |
MessageQueue * | getInputMessageQueue () |
void | start () |
This thread start. More... | |
void | stop () |
This thread stop. More... | |
bool | initGeneration () |
Initialize generation sequence. More... | |
bool | startGeneration () |
Start generation sequence. More... | |
void | stopGeneration () |
Stop generation sequence. More... | |
void | setSink (DeviceSampleSink *sink) |
Set the sample sink type. More... | |
DeviceSampleSink * | getSink () |
void | setSinkSequence (int sequence) |
Set the sample sink sequence in type. More... | |
void | addThreadedSource (ThreadedBasebandSampleSource *source) |
Add a baseband sample source that will run on its own thread. More... | |
void | removeThreadedSource (ThreadedBasebandSampleSource *source) |
Remove a baseband sample source that runs on its own thread. More... | |
void | addSpectrumSink (BasebandSampleSink *spectrumSink) |
Add a spectrum vis baseband sample sink. More... | |
void | removeSpectrumSink (BasebandSampleSink *spectrumSink) |
Add a spectrum vis baseband sample sink. More... | |
State | state () const |
Return DSP engine current state. More... | |
QString | errorMessage () |
Return the current error message. More... | |
QString | sinkDeviceDescription () |
Return the sink device description. More... | |
Private Types | |
typedef std::list< BasebandSampleSource * > | BasebandSampleSources |
typedef std::list< ThreadedBasebandSampleSource * > | ThreadedBasebandSampleSources |
typedef std::map< BasebandSampleSource *, SampleVector::iterator > | BasebandSampleSourcesIteratorMap |
typedef std::pair< BasebandSampleSource *, SampleVector::iterator > | BasebandSampleSourcesIteratorMapKV |
typedef std::map< ThreadedBasebandSampleSource *, SampleVector::iterator > | ThreadedBasebandSampleSourcesIteratorMap |
typedef std::pair< ThreadedBasebandSampleSource *, SampleVector::iterator > | ThreadedBasebandSampleSourcesIteratorMapKV |
Private Slots | |
void | handleData (int nbSamples) |
Handle data when samples have to be written to the sample FIFO. More... | |
void | handleInputMessages () |
Handle input message queue. More... | |
void | handleSynchronousMessages () |
Handle synchronous messages with the thread. More... | |
void | handleForwardToSpectrumSink (int nbSamples) |
Private Member Functions | |
void | run () |
void | work (int nbWriteSamples) |
transfer samples from beseband sources to sink if in running state More... | |
State | gotoIdle () |
Go to the idle state. More... | |
State | gotoInit () |
Go to the acquisition init state from idle. More... | |
State | gotoRunning () |
Go to the running state from ready state. More... | |
State | gotoError (const QString &errorMsg) |
Go to an error state. More... | |
void | handleSetSink (DeviceSampleSink *sink) |
Manage sink setting. More... | |
void | checkNumberOfBasebandSources () |
Private Attributes | |
uint32_t | m_uid |
unique ID More... | |
MessageQueue | m_inputMessageQueue |
SyncMessenger | m_syncMessenger |
Used to process messages synchronously with the thread. More... | |
State | m_state |
QString | m_errorMessage |
QString | m_deviceDescription |
DeviceSampleSink * | m_deviceSampleSink |
int | m_sampleSinkSequence |
BasebandSampleSources | m_basebandSampleSources |
baseband sample sources within main thread (usually file input) More... | |
ThreadedBasebandSampleSources | m_threadedBasebandSampleSources |
baseband sample sources on their own threads (usually channels) More... | |
BasebandSampleSourcesIteratorMap | m_basebandSampleSourcesIteratorMap |
ThreadedBasebandSampleSourcesIteratorMap | m_threadedBasebandSampleSourcesIteratorMap |
BasebandSampleSink * | m_spectrumSink |
uint32_t | m_sampleRate |
quint64 | m_centerFrequency |
uint32_t | m_multipleSourcesDivisionFactor |
Definition at line 40 of file dspdevicesinkengine.h.
|
private |
Definition at line 95 of file dspdevicesinkengine.h.
|
private |
Definition at line 101 of file dspdevicesinkengine.h.
|
private |
Definition at line 102 of file dspdevicesinkengine.h.
|
private |
Definition at line 98 of file dspdevicesinkengine.h.
|
private |
Definition at line 105 of file dspdevicesinkengine.h.
|
private |
Definition at line 106 of file dspdevicesinkengine.h.
Enumerator | |
---|---|
StNotStarted | engine is before initialization |
StIdle | engine is idle |
StReady | engine is ready to run |
StRunning | engine is running |
StError | engine is in error |
Definition at line 44 of file dspdevicesinkengine.h.
DSPDeviceSinkEngine::DSPDeviceSinkEngine | ( | uint32_t | uid, |
QObject * | parent = NULL |
||
) |
Definition at line 32 of file dspdevicesinkengine.cpp.
References handleInputMessages(), handleSynchronousMessages(), m_inputMessageQueue, and m_syncMessenger.
DSPDeviceSinkEngine::~DSPDeviceSinkEngine | ( | ) |
Definition at line 50 of file dspdevicesinkengine.cpp.
References stop().
void DSPDeviceSinkEngine::addSpectrumSink | ( | BasebandSampleSink * | spectrumSink | ) |
Add a spectrum vis baseband sample sink.
Definition at line 130 of file dspdevicesinkengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::addAncillarySink(), and MainWindow::addSinkDevice().
void DSPDeviceSinkEngine::addThreadedSource | ( | ThreadedBasebandSampleSource * | source | ) |
Add a baseband sample source that will run on its own thread.
Definition at line 116 of file dspdevicesinkengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::addChannelSource().
|
private |
Definition at line 570 of file dspdevicesinkengine.cpp.
References DeviceSampleSink::getSampleFifo(), handleData(), m_basebandSampleSources, m_deviceSampleSink, m_multipleSourcesDivisionFactor, and m_threadedBasebandSampleSources.
Referenced by handleSynchronousMessages().
QString DSPDeviceSinkEngine::errorMessage | ( | ) |
Return the current error message.
Definition at line 144 of file dspdevicesinkengine.cpp.
References DSPGetErrorMessage::getErrorMessage(), m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::errorMessage(), and gotoError().
|
inline |
Definition at line 57 of file dspdevicesinkengine.h.
Referenced by DeviceAPI::getDeviceEngineInputMessageQueue().
|
inline |
Definition at line 67 of file dspdevicesinkengine.h.
Referenced by WebAPIAdapterGUI::getDeviceSet(), WebAPIAdapterSrv::getDeviceSet(), LocalSource::getLocalDevice(), LocalSource::getLocalDevices(), DeviceAPI::getSampleSink(), DeviceAPI::getSamplingDeviceGUIMessageQueue(), DeviceAPI::getSamplingDeviceInputMessageQueue(), WebAPIAdapterGUI::instancePresetPost(), WebAPIAdapterSrv::instancePresetPost(), DeviceAPI::loadSamplingDeviceSettings(), and DeviceAPI::saveSamplingDeviceSettings().
|
inline |
Definition at line 55 of file dspdevicesinkengine.h.
Referenced by MainCore::addSinkDevice(), MainWindow::addSinkDevice(), DeviceAPI::getDeviceUID(), and LocalSource::getLocalDevice().
|
private |
Go to an error state.
Definition at line 378 of file dspdevicesinkengine.cpp.
References errorMessage(), m_deviceDescription, m_errorMessage, m_state, and StError.
Referenced by gotoInit(), and gotoRunning().
|
private |
Go to the idle state.
Definition at line 212 of file dspdevicesinkengine.cpp.
References DeviceSampleSink::getSampleFifo(), handleForwardToSpectrumSink(), m_basebandSampleSources, m_deviceDescription, m_deviceSampleSink, m_sampleRate, m_spectrumSink, m_state, m_threadedBasebandSampleSources, StError, StIdle, StNotStarted, DeviceSampleSink::stop(), BasebandSampleSink::stop(), StReady, and StRunning.
Referenced by handleSetSink(), handleSynchronousMessages(), and stop().
|
private |
Go to the acquisition init state from idle.
Definition at line 261 of file dspdevicesinkengine.cpp.
References DeviceSampleSink::getCenterFrequency(), DeviceSampleSink::getDeviceDescription(), DeviceSampleSink::getMessageQueueToGUI(), DeviceSampleSink::getSampleRate(), gotoError(), BasebandSampleSink::handleMessage(), m_basebandSampleSources, m_centerFrequency, m_deviceDescription, m_deviceSampleSink, m_sampleRate, m_spectrumSink, m_state, m_threadedBasebandSampleSources, MessageQueue::push(), StError, StIdle, StNotStarted, StReady, and StRunning.
Referenced by handleSynchronousMessages().
|
private |
Go to the running state from ready state.
Definition at line 322 of file dspdevicesinkengine.cpp.
References DeviceSampleSink::getSampleFifo(), gotoError(), handleForwardToSpectrumSink(), m_basebandSampleSources, m_deviceDescription, m_deviceSampleSink, m_inputMessageQueue, m_spectrumSink, m_state, m_threadedBasebandSampleSources, MessageQueue::size(), DeviceSampleSink::start(), BasebandSampleSink::start(), StError, StIdle, StNotStarted, StReady, and StRunning.
Referenced by handleSynchronousMessages().
|
privateslot |
Handle data when samples have to be written to the sample FIFO.
Definition at line 401 of file dspdevicesinkengine.cpp.
References m_state, StRunning, and work().
Referenced by checkNumberOfBasebandSources().
|
privateslot |
Definition at line 559 of file dspdevicesinkengine.cpp.
References BasebandSampleSink::feed(), SampleSourceFifo::getReadIterator(), DeviceSampleSink::getSampleFifo(), m_deviceSampleSink, and m_spectrumSink.
Referenced by gotoIdle(), and gotoRunning().
|
privateslot |
Handle input message queue.
Definition at line 508 of file dspdevicesinkengine.cpp.
References DSPSignalNotification::getCenterFrequency(), Message::getIdentifier(), DeviceSampleSink::getMessageQueueToGUI(), DSPSignalNotification::getSampleRate(), m_basebandSampleSources, m_centerFrequency, m_deviceSampleSink, m_inputMessageQueue, m_sampleRate, m_threadedBasebandSampleSources, Message::match(), MessageQueue::pop(), and MessageQueue::push().
Referenced by DSPDeviceSinkEngine().
|
private |
Manage sink setting.
Definition at line 388 of file dspdevicesinkengine.cpp.
References DeviceSampleSink::getDeviceDescription(), gotoIdle(), and m_deviceSampleSink.
Referenced by handleSynchronousMessages().
|
privateslot |
Handle synchronous messages with the thread.
Definition at line 409 of file dspdevicesinkengine.cpp.
References checkNumberOfBasebandSources(), SyncMessenger::done(), Message::getIdentifier(), SyncMessenger::getMessage(), gotoIdle(), gotoInit(), gotoRunning(), BasebandSampleSource::handleMessage(), handleSetSink(), ThreadedBasebandSampleSource::handleSourceMessage(), m_basebandSampleSources, m_centerFrequency, m_deviceDescription, m_errorMessage, m_sampleRate, m_spectrumSink, m_state, m_syncMessenger, m_threadedBasebandSampleSources, Message::match(), BasebandSampleSource::start(), ThreadedBasebandSampleSource::start(), StIdle, BasebandSampleSource::stop(), ThreadedBasebandSampleSource::stop(), BasebandSampleSink::stop(), StReady, and StRunning.
Referenced by DSPDeviceSinkEngine(), and stopGeneration().
bool DSPDeviceSinkEngine::initGeneration | ( | ) |
Initialize generation sequence.
Definition at line 79 of file dspdevicesinkengine.cpp.
References m_syncMessenger, SyncMessenger::sendWait(), and StReady.
Referenced by DeviceAPI::initDeviceEngine().
void DSPDeviceSinkEngine::removeSpectrumSink | ( | BasebandSampleSink * | spectrumSink | ) |
Add a spectrum vis baseband sample sink.
Definition at line 137 of file dspdevicesinkengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::removeAncillarySink(), and MainWindow::removeLastDevice().
void DSPDeviceSinkEngine::removeThreadedSource | ( | ThreadedBasebandSampleSource * | source | ) |
Remove a baseband sample source that runs on its own thread.
Definition at line 123 of file dspdevicesinkengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::removeChannelSource().
|
private |
void DSPDeviceSinkEngine::setSink | ( | DeviceSampleSink * | sink | ) |
Set the sample sink type.
Definition at line 103 of file dspdevicesinkengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::setSampleSink().
void DSPDeviceSinkEngine::setSinkSequence | ( | int | sequence | ) |
Set the sample sink sequence in type.
Definition at line 110 of file dspdevicesinkengine.cpp.
References m_sampleSinkSequence.
QString DSPDeviceSinkEngine::sinkDeviceDescription | ( | ) |
Return the sink device description.
Definition at line 152 of file dspdevicesinkengine.cpp.
References DSPGetSinkDeviceDescription::getDeviceDescription(), m_syncMessenger, and SyncMessenger::sendWait().
void DSPDeviceSinkEngine::start | ( | ) |
This thread start.
Definition at line 63 of file dspdevicesinkengine.cpp.
Referenced by MainCore::addSinkDevice(), and MainWindow::addSinkDevice().
bool DSPDeviceSinkEngine::startGeneration | ( | ) |
Start generation sequence.
Definition at line 87 of file dspdevicesinkengine.cpp.
References m_syncMessenger, SyncMessenger::sendWait(), and StRunning.
Referenced by DeviceAPI::startDeviceEngine().
|
inline |
Return DSP engine current state.
Definition at line 76 of file dspdevicesinkengine.h.
Referenced by Bladerf1Input::applySettings(), DeviceAPI::getDeviceEngineStateStr(), and DeviceAPI::state().
void DSPDeviceSinkEngine::stop | ( | ) |
This thread stop.
Definition at line 69 of file dspdevicesinkengine.cpp.
References gotoIdle(), m_state, and StNotStarted.
Referenced by MainCore::removeLastDevice(), MainWindow::removeLastDevice(), and ~DSPDeviceSinkEngine().
void DSPDeviceSinkEngine::stopGeneration | ( | ) |
Stop generation sequence.
Definition at line 95 of file dspdevicesinkengine.cpp.
References handleSynchronousMessages(), m_syncMessenger, and SyncMessenger::storeMessage().
Referenced by MainCore::removeLastDevice(), MainWindow::removeLastDevice(), and DeviceAPI::stopDeviceEngine().
|
private |
transfer samples from beseband sources to sink if in running state
Definition at line 160 of file dspdevicesinkengine.cpp.
References SampleSourceFifo::bumpIndex(), DeviceSampleSink::getSampleFifo(), SampleSourceFifo::getWriteIterator(), m_basebandSampleSources, m_deviceSampleSink, m_multipleSourcesDivisionFactor, and m_threadedBasebandSampleSources.
Referenced by handleData().
|
private |
baseband sample sources within main thread (usually file input)
Definition at line 96 of file dspdevicesinkengine.h.
Referenced by checkNumberOfBasebandSources(), gotoIdle(), gotoInit(), gotoRunning(), handleInputMessages(), handleSynchronousMessages(), and work().
|
private |
Definition at line 103 of file dspdevicesinkengine.h.
|
private |
Definition at line 112 of file dspdevicesinkengine.h.
Referenced by gotoInit(), handleInputMessages(), and handleSynchronousMessages().
|
private |
Definition at line 90 of file dspdevicesinkengine.h.
Referenced by gotoError(), gotoIdle(), gotoInit(), gotoRunning(), and handleSynchronousMessages().
|
private |
Definition at line 92 of file dspdevicesinkengine.h.
Referenced by checkNumberOfBasebandSources(), gotoIdle(), gotoInit(), gotoRunning(), handleForwardToSpectrumSink(), handleInputMessages(), handleSetSink(), and work().
|
private |
Definition at line 89 of file dspdevicesinkengine.h.
Referenced by gotoError(), and handleSynchronousMessages().
|
private |
Definition at line 84 of file dspdevicesinkengine.h.
Referenced by DSPDeviceSinkEngine(), gotoRunning(), and handleInputMessages().
|
private |
Definition at line 113 of file dspdevicesinkengine.h.
Referenced by checkNumberOfBasebandSources(), and work().
|
private |
Definition at line 111 of file dspdevicesinkengine.h.
Referenced by gotoIdle(), gotoInit(), handleInputMessages(), and handleSynchronousMessages().
|
private |
Definition at line 93 of file dspdevicesinkengine.h.
Referenced by setSinkSequence().
|
private |
Definition at line 109 of file dspdevicesinkengine.h.
Referenced by gotoIdle(), gotoInit(), gotoRunning(), handleForwardToSpectrumSink(), and handleSynchronousMessages().
|
private |
Definition at line 87 of file dspdevicesinkengine.h.
Referenced by gotoError(), gotoIdle(), gotoInit(), gotoRunning(), handleData(), handleSynchronousMessages(), run(), and stop().
|
private |
Used to process messages synchronously with the thread.
Definition at line 85 of file dspdevicesinkengine.h.
Referenced by addSpectrumSink(), addThreadedSource(), DSPDeviceSinkEngine(), errorMessage(), handleSynchronousMessages(), initGeneration(), removeSpectrumSink(), removeThreadedSource(), setSink(), sinkDeviceDescription(), startGeneration(), and stopGeneration().
|
private |
baseband sample sources on their own threads (usually channels)
Definition at line 99 of file dspdevicesinkengine.h.
Referenced by checkNumberOfBasebandSources(), gotoIdle(), gotoInit(), gotoRunning(), handleInputMessages(), handleSynchronousMessages(), and work().
|
private |
Definition at line 107 of file dspdevicesinkengine.h.
|
private |
unique ID
Definition at line 82 of file dspdevicesinkengine.h.