![]() |
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 <dspdevicesourceengine.h>
Inherits QThread.
Collaboration diagram for DSPDeviceSourceEngine:Public Types | |
| enum | State { StNotStarted, StIdle, StReady, StRunning, StError } |
Public Member Functions | |
| DSPDeviceSourceEngine (uint uid, QObject *parent=NULL) | |
| ~DSPDeviceSourceEngine () | |
| uint | getUID () const |
| MessageQueue * | getInputMessageQueue () |
| void | start () |
| This thread start. More... | |
| void | stop () |
| This thread stop. More... | |
| bool | initAcquisition () |
| Initialize acquisition sequence. More... | |
| bool | startAcquisition () |
| Start acquisition sequence. More... | |
| void | stopAcquistion () |
| Stop acquisition sequence. More... | |
| void | setSource (DeviceSampleSource *source) |
| Set the sample source type. More... | |
| void | setSourceSequence (int sequence) |
| Set the sample source sequence in type. More... | |
| DeviceSampleSource * | getSource () |
| void | addSink (BasebandSampleSink *sink) |
| Add a sample sink. More... | |
| void | removeSink (BasebandSampleSink *sink) |
| Remove a sample sink. More... | |
| void | addThreadedSink (ThreadedBasebandSampleSink *sink) |
| Add a sample sink that will run on its own thread. More... | |
| void | removeThreadedSink (ThreadedBasebandSampleSink *sink) |
| Remove a sample sink that runs on its own thread. More... | |
| void | configureCorrections (bool dcOffsetCorrection, bool iqImbalanceCorrection) |
| Configure DSP corrections. More... | |
| State | state () const |
| Return DSP engine current state. More... | |
| QString | errorMessage () |
| Return the current error message. More... | |
| QString | sourceDeviceDescription () |
| Return the source device description. More... | |
Private Types | |
| typedef std::list< BasebandSampleSink * > | BasebandSampleSinks |
| typedef std::list< ThreadedBasebandSampleSink * > | ThreadedBasebandSampleSinks |
Private Slots | |
| void | handleData () |
| Handle data when samples from source FIFO are ready to be processed. More... | |
| void | handleInputMessages () |
| Handle input message queue. More... | |
| void | handleSynchronousMessages () |
| Handle synchronous messages with the thread. More... | |
Private Member Functions | |
| void | run () |
| void | iqCorrections (SampleVector::iterator begin, SampleVector::iterator end, bool imbalanceCorrection) |
| void | dcOffset (SampleVector::iterator begin, SampleVector::iterator end) |
| void | imbalance (SampleVector::iterator begin, SampleVector::iterator end) |
| void | work () |
| transfer samples from source to sinks 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 | handleSetSource (DeviceSampleSource *source) |
| Manage source setting. More... | |
Definition at line 37 of file dspdevicesourceengine.h.
|
private |
Definition at line 94 of file dspdevicesourceengine.h.
|
private |
Definition at line 97 of file dspdevicesourceengine.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 41 of file dspdevicesourceengine.h.
| DSPDeviceSourceEngine::DSPDeviceSourceEngine | ( | uint | uid, |
| QObject * | parent = NULL |
||
| ) |
Definition at line 31 of file dspdevicesourceengine.cpp.
References handleInputMessages(), handleSynchronousMessages(), m_inputMessageQueue, and m_syncMessenger.
Here is the call graph for this function:| DSPDeviceSourceEngine::~DSPDeviceSourceEngine | ( | ) |
Definition at line 54 of file dspdevicesourceengine.cpp.
References stop().
Here is the call graph for this function:| void DSPDeviceSourceEngine::addSink | ( | BasebandSampleSink * | sink | ) |
Add a sample sink.
Definition at line 125 of file dspdevicesourceengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::addAncillarySink(), and MainWindow::addSourceDevice().
Here is the call graph for this function:
Here is the caller graph for this function:| void DSPDeviceSourceEngine::addThreadedSink | ( | ThreadedBasebandSampleSink * | sink | ) |
Add a sample sink that will run on its own thread.
Definition at line 139 of file dspdevicesourceengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::addChannelSink().
Here is the call graph for this function:
Here is the caller graph for this function:| void DSPDeviceSourceEngine::configureCorrections | ( | bool | dcOffsetCorrection, |
| bool | iqImbalanceCorrection | ||
| ) |
Configure DSP corrections.
Definition at line 153 of file dspdevicesourceengine.cpp.
References m_inputMessageQueue, and MessageQueue::push().
Referenced by DeviceAPI::configureCorrections().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 265 of file dspdevicesourceengine.cpp.
References m_iBeta, and m_qBeta.
| QString DSPDeviceSourceEngine::errorMessage | ( | ) |
Return the current error message.
Definition at line 160 of file dspdevicesourceengine.cpp.
References DSPGetErrorMessage::getErrorMessage(), m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::errorMessage(), and gotoError().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 54 of file dspdevicesourceengine.h.
Referenced by DeviceAPI::getDeviceEngineInputMessageQueue().
Here is the caller graph for this function:
|
inline |
Definition at line 65 of file dspdevicesourceengine.h.
Referenced by WebAPIAdapterGUI::getDeviceSet(), WebAPIAdapterSrv::getDeviceSet(), LocalSink::getLocalDevice(), LocalSink::getLocalDevices(), DeviceAPI::getSampleSource(), DeviceAPI::getSamplingDeviceGUIMessageQueue(), DeviceAPI::getSamplingDeviceInputMessageQueue(), WebAPIAdapterGUI::instancePresetPost(), WebAPIAdapterSrv::instancePresetPost(), DeviceAPI::loadSamplingDeviceSettings(), and DeviceAPI::saveSamplingDeviceSettings().
Here is the caller graph for this function:
|
inline |
Definition at line 52 of file dspdevicesourceengine.h.
Referenced by MainCore::addSourceDevice(), MainWindow::addSourceDevice(), DeviceAPI::getDeviceUID(), and LocalSink::getLocalDevice().
Here is the caller graph for this function:
|
private |
Go to an error state.
Definition at line 568 of file dspdevicesourceengine.cpp.
References errorMessage(), m_deviceDescription, m_errorMessage, m_state, and StError.
Referenced by gotoInit(), and gotoRunning().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Go to the idle state.
Definition at line 415 of file dspdevicesourceengine.cpp.
References m_basebandSampleSinks, m_deviceDescription, m_deviceSampleSource, m_sampleRate, m_state, m_threadedBasebandSampleSinks, StError, StIdle, StNotStarted, DeviceSampleSource::stop(), StReady, and StRunning.
Referenced by handleSetSource(), handleSynchronousMessages(), and stop().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Go to the acquisition init state from idle.
Definition at line 456 of file dspdevicesourceengine.cpp.
References DeviceSampleSource::getCenterFrequency(), DeviceSampleSource::getDeviceDescription(), DeviceSampleSource::getMessageQueueToGUI(), DeviceSampleSource::getSampleRate(), gotoError(), m_basebandSampleSinks, m_centerFrequency, m_deviceDescription, m_deviceSampleSource, m_iOffset, m_iRange, m_qOffset, m_qRange, m_sampleRate, m_state, m_threadedBasebandSampleSinks, MessageQueue::push(), StError, StIdle, StNotStarted, StReady, and StRunning.
Referenced by handleSynchronousMessages().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Go to the running state from ready state.
Definition at line 518 of file dspdevicesourceengine.cpp.
References gotoError(), m_basebandSampleSinks, m_deviceDescription, m_deviceSampleSource, m_inputMessageQueue, m_state, m_threadedBasebandSampleSinks, MessageQueue::size(), DeviceSampleSource::start(), StError, StIdle, StNotStarted, StReady, and StRunning.
Referenced by handleSynchronousMessages().
Here is the call graph for this function:
Here is the caller graph for this function:
|
privateslot |
Handle data when samples from source FIFO are ready to be processed.
Definition at line 600 of file dspdevicesourceengine.cpp.
References m_state, StRunning, and work().
Referenced by handleSetSource().
Here is the call graph for this function:
Here is the caller graph for this function:
|
privateslot |
Handle input message queue.
Definition at line 686 of file dspdevicesourceengine.cpp.
References DSPSignalNotification::getCenterFrequency(), DSPConfigureCorrection::getDCOffsetCorrection(), Message::getIdentifier(), DSPConfigureCorrection::getIQImbalanceCorrection(), DeviceSampleSource::getMessageQueueToGUI(), DSPSignalNotification::getSampleRate(), m_avgAmp, m_avgII, m_avgII2, m_avgIQ, m_avgPhi, m_avgQQ2, m_basebandSampleSinks, m_centerFrequency, m_dcOffsetCorrection, m_deviceSampleSource, m_iBeta, m_imbalance, m_inputMessageQueue, m_iOffset, m_iqImbalanceCorrection, m_iRange, m_qBeta, m_qOffset, m_qRange, m_sampleRate, m_threadedBasebandSampleSinks, Message::match(), MessageQueue::pop(), MessageQueue::push(), and MovingAverageUtil< T, Total, N >::reset().
Referenced by DSPDeviceSourceEngine().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Manage source setting.
Definition at line 578 of file dspdevicesourceengine.cpp.
References DeviceSampleSource::getDeviceDescription(), DeviceSampleSource::getSampleFifo(), gotoIdle(), handleData(), and m_deviceSampleSource.
Referenced by handleSynchronousMessages().
Here is the call graph for this function:
Here is the caller graph for this function:
|
privateslot |
Handle synchronous messages with the thread.
Definition at line 608 of file dspdevicesourceengine.cpp.
References SyncMessenger::done(), Message::getIdentifier(), SyncMessenger::getMessage(), gotoIdle(), gotoInit(), gotoRunning(), BasebandSampleSink::handleMessage(), handleSetSource(), ThreadedBasebandSampleSink::handleSinkMessage(), m_basebandSampleSinks, m_centerFrequency, m_deviceDescription, m_errorMessage, m_sampleRate, m_state, m_syncMessenger, m_threadedBasebandSampleSinks, Message::match(), BasebandSampleSink::start(), ThreadedBasebandSampleSink::start(), StIdle, BasebandSampleSink::stop(), ThreadedBasebandSampleSink::stop(), StReady, and StRunning.
Referenced by DSPDeviceSourceEngine(), and stopAcquistion().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 277 of file dspdevicesourceengine.cpp.
References m_imbalance, m_iRange, m_qRange, and SDR_RX_SAMP_SZ.
| bool DSPDeviceSourceEngine::initAcquisition | ( | ) |
Initialize acquisition sequence.
Definition at line 83 of file dspdevicesourceengine.cpp.
References m_syncMessenger, SyncMessenger::sendWait(), and StReady.
Referenced by DeviceAPI::initDeviceEngine().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 176 of file dspdevicesourceengine.cpp.
References Fixed< IntType, IntBits >::as_internal(), MovingAverageUtil< T, Total, N >::asDouble(), m_avgAmp, m_avgII, m_avgII2, m_avgIQ, m_avgPhi, m_avgQQ2, m_iBeta, m_qBeta, SDR_RX_SCALEF, and sqrt().
Referenced by work().
Here is the call graph for this function:
Here is the caller graph for this function:| void DSPDeviceSourceEngine::removeSink | ( | BasebandSampleSink * | sink | ) |
Remove a sample sink.
Definition at line 132 of file dspdevicesourceengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::removeAncillarySink(), and MainWindow::removeLastDevice().
Here is the call graph for this function:
Here is the caller graph for this function:| void DSPDeviceSourceEngine::removeThreadedSink | ( | ThreadedBasebandSampleSink * | sink | ) |
Remove a sample sink that runs on its own thread.
Definition at line 146 of file dspdevicesourceengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::removeChannelSink().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
| void DSPDeviceSourceEngine::setSource | ( | DeviceSampleSource * | source | ) |
Set the sample source type.
Definition at line 112 of file dspdevicesourceengine.cpp.
References m_syncMessenger, and SyncMessenger::sendWait().
Referenced by DeviceAPI::setSampleSource().
Here is the call graph for this function:
Here is the caller graph for this function:| void DSPDeviceSourceEngine::setSourceSequence | ( | int | sequence | ) |
Set the sample source sequence in type.
Definition at line 119 of file dspdevicesourceengine.cpp.
References m_sampleSourceSequence.
| QString DSPDeviceSourceEngine::sourceDeviceDescription | ( | ) |
Return the source device description.
Definition at line 168 of file dspdevicesourceengine.cpp.
References DSPGetSourceDeviceDescription::getDeviceDescription(), m_syncMessenger, and SyncMessenger::sendWait().
Here is the call graph for this function:| void DSPDeviceSourceEngine::start | ( | ) |
This thread start.
Definition at line 67 of file dspdevicesourceengine.cpp.
Referenced by MainCore::addSourceDevice(), and MainWindow::addSourceDevice().
Here is the caller graph for this function:| bool DSPDeviceSourceEngine::startAcquisition | ( | ) |
Start acquisition sequence.
Definition at line 91 of file dspdevicesourceengine.cpp.
References m_syncMessenger, SyncMessenger::sendWait(), and StRunning.
Referenced by DeviceAPI::startDeviceEngine().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Return DSP engine current state.
Definition at line 75 of file dspdevicesourceengine.h.
Referenced by Bladerf1Output::applySettings(), DeviceAPI::getDeviceEngineStateStr(), and DeviceAPI::state().
Here is the caller graph for this function:| void DSPDeviceSourceEngine::stop | ( | ) |
This thread stop.
Definition at line 73 of file dspdevicesourceengine.cpp.
References gotoIdle(), m_state, and StNotStarted.
Referenced by MainCore::removeLastDevice(), MainWindow::removeLastDevice(), and ~DSPDeviceSourceEngine().
Here is the call graph for this function:
Here is the caller graph for this function:| void DSPDeviceSourceEngine::stopAcquistion | ( | ) |
Stop acquisition sequence.
Definition at line 99 of file dspdevicesourceengine.cpp.
References handleSynchronousMessages(), m_dcOffsetCorrection, m_iOffset, m_qOffset, m_syncMessenger, and SyncMessenger::storeMessage().
Referenced by MainCore::removeLastDevice(), MainWindow::removeLastDevice(), and DeviceAPI::stopDeviceEngine().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
transfer samples from source to sinks if in running state
Definition at line 326 of file dspdevicesourceengine.cpp.
References SampleSinkFifo::fill(), DeviceSampleSource::getSampleFifo(), iqCorrections(), m_basebandSampleSinks, m_dcOffsetCorrection, m_deviceSampleSource, m_inputMessageQueue, m_iqImbalanceCorrection, m_sampleRate, m_threadedBasebandSampleSinks, SampleSinkFifo::readBegin(), SampleSinkFifo::readCommit(), and MessageQueue::size().
Referenced by handleData().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 126 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and iqCorrections().
|
private |
Definition at line 121 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and iqCorrections().
|
private |
Definition at line 123 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and iqCorrections().
|
private |
Definition at line 122 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and iqCorrections().
|
private |
Definition at line 125 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and iqCorrections().
|
private |
Definition at line 124 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and iqCorrections().
|
private |
sample sinks within main thread (usually spectrum, file output)
Definition at line 95 of file dspdevicesourceengine.h.
Referenced by gotoIdle(), gotoInit(), gotoRunning(), handleInputMessages(), handleSynchronousMessages(), and work().
|
private |
Definition at line 101 of file dspdevicesourceengine.h.
Referenced by gotoInit(), handleInputMessages(), and handleSynchronousMessages().
|
private |
Definition at line 103 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), stopAcquistion(), and work().
|
private |
Definition at line 89 of file dspdevicesourceengine.h.
Referenced by gotoError(), gotoIdle(), gotoInit(), gotoRunning(), and handleSynchronousMessages().
|
private |
Definition at line 91 of file dspdevicesourceengine.h.
Referenced by gotoIdle(), gotoInit(), gotoRunning(), handleInputMessages(), handleSetSource(), and work().
|
private |
Definition at line 88 of file dspdevicesourceengine.h.
Referenced by gotoError(), and handleSynchronousMessages().
|
private |
Definition at line 107 of file dspdevicesourceengine.h.
Referenced by dcOffset(), handleInputMessages(), and iqCorrections().
|
private |
Definition at line 131 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and imbalance().
|
private |
Definition at line 83 of file dspdevicesourceengine.h.
Referenced by configureCorrections(), DSPDeviceSourceEngine(), gotoRunning(), handleInputMessages(), and work().
|
private |
Definition at line 105 of file dspdevicesourceengine.h.
Referenced by gotoInit(), handleInputMessages(), and stopAcquistion().
|
private |
Definition at line 104 of file dspdevicesourceengine.h.
Referenced by handleInputMessages(), and work().
|
private |
Definition at line 129 of file dspdevicesourceengine.h.
Referenced by gotoInit(), handleInputMessages(), and imbalance().
|
private |
Definition at line 108 of file dspdevicesourceengine.h.
Referenced by dcOffset(), handleInputMessages(), and iqCorrections().
|
private |
Definition at line 105 of file dspdevicesourceengine.h.
Referenced by gotoInit(), handleInputMessages(), and stopAcquistion().
|
private |
Definition at line 130 of file dspdevicesourceengine.h.
Referenced by gotoInit(), handleInputMessages(), and imbalance().
|
private |
Definition at line 100 of file dspdevicesourceengine.h.
Referenced by gotoIdle(), gotoInit(), handleInputMessages(), handleSynchronousMessages(), and work().
|
private |
Definition at line 92 of file dspdevicesourceengine.h.
Referenced by setSourceSequence().
|
private |
Definition at line 86 of file dspdevicesourceengine.h.
Referenced by gotoError(), gotoIdle(), gotoInit(), gotoRunning(), handleData(), handleSynchronousMessages(), run(), and stop().
|
private |
Used to process messages synchronously with the thread.
Definition at line 84 of file dspdevicesourceengine.h.
Referenced by addSink(), addThreadedSink(), DSPDeviceSourceEngine(), errorMessage(), handleSynchronousMessages(), initAcquisition(), removeSink(), removeThreadedSink(), setSource(), sourceDeviceDescription(), startAcquisition(), and stopAcquistion().
|
private |
sample sinks on their own threads (usually channels)
Definition at line 98 of file dspdevicesourceengine.h.
Referenced by gotoIdle(), gotoInit(), gotoRunning(), handleInputMessages(), handleSynchronousMessages(), and work().
|
private |
unique ID
Definition at line 81 of file dspdevicesourceengine.h.
1.8.13