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.
Public Member Functions | Protected Attributes | List of all members
ThreadedBasebandSampleSink Class Reference

#include <threadedbasebandsamplesink.h>

Inherits QObject.

+ Collaboration diagram for ThreadedBasebandSampleSink:

Public Member Functions

 ThreadedBasebandSampleSink (BasebandSampleSink *sampleSink, QObject *parent=0)
 
 ~ThreadedBasebandSampleSink ()
 
const BasebandSampleSinkgetSink () const
 
void start ()
 this thread start() More...
 
void stop ()
 this thread exit() and wait() More...
 
bool handleSinkMessage (const Message &cmd)
 Send message to sink synchronously. More...
 
void feed (SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
 Feed sink with samples. More...
 
QString getSampleSinkObjectName () const
 
const QThread * getThread () const
 

Protected Attributes

QThread * m_thread
 The thead object. More...
 
ThreadedBasebandSampleSinkFifom_threadedBasebandSampleSinkFifo
 
BasebandSampleSinkm_basebandSampleSink
 

Detailed Description

This class is a wrapper for SampleSink that runs the SampleSink object in its own thread

Definition at line 54 of file threadedbasebandsamplesink.h.

Constructor & Destructor Documentation

◆ ThreadedBasebandSampleSink()

ThreadedBasebandSampleSink::ThreadedBasebandSampleSink ( BasebandSampleSink sampleSink,
QObject *  parent = 0 
)

Definition at line 66 of file threadedbasebandsamplesink.cpp.

References BasebandSampleSink::MsgThreadedSink::create(), BasebandSampleSink::handleMessage(), m_basebandSampleSink, m_thread, and m_threadedBasebandSampleSinkFifo.

66  :
67  m_basebandSampleSink(sampleSink)
68 {
69  QString name = "ThreadedBasebandSampleSink(" + m_basebandSampleSink->objectName() + ")";
70  setObjectName(name);
71 
72  qDebug() << "ThreadedBasebandSampleSink::ThreadedBasebandSampleSink: " << name;
73 
74  m_thread = new QThread(parent);
76  //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
77  m_basebandSampleSink->moveToThread(m_thread);
81  delete msg;
82  //m_sampleFifo.moveToThread(m_thread);
83  //connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleData()));
84  //m_sampleFifo.setSize(262144);
85 
86  qDebug() << "ThreadedBasebandSampleSink::ThreadedBasebandSampleSink: thread: " << thread() << " m_thread: " << m_thread;
87 }
QThread * m_thread
The thead object.
ThreadedBasebandSampleSinkFifo * m_threadedBasebandSampleSinkFifo
BasebandSampleSink * m_basebandSampleSink
virtual bool handleMessage(const Message &cmd)=0
Processing of a message. Returns true if message has actually been processed.
static MsgThreadedSink * create(const QThread *thread)
+ Here is the call graph for this function:

◆ ~ThreadedBasebandSampleSink()

ThreadedBasebandSampleSink::~ThreadedBasebandSampleSink ( )

Definition at line 89 of file threadedbasebandsamplesink.cpp.

References m_thread, m_threadedBasebandSampleSinkFifo, and stop().

90 {
91  if (m_thread->isRunning()) {
92  stop();
93  }
94 
95  delete m_threadedBasebandSampleSinkFifo; // Valgrind memcheck
96  delete m_thread;
97 }
QThread * m_thread
The thead object.
ThreadedBasebandSampleSinkFifo * m_threadedBasebandSampleSinkFifo
void stop()
this thread exit() and wait()
+ Here is the call graph for this function:

Member Function Documentation

◆ feed()

void ThreadedBasebandSampleSink::feed ( SampleVector::const_iterator  begin,
SampleVector::const_iterator  end,
bool  positiveOnly 
)

Feed sink with samples.

Definition at line 114 of file threadedbasebandsamplesink.cpp.

References m_threadedBasebandSampleSinkFifo, and ThreadedBasebandSampleSinkFifo::writeToFifo().

115 {
116  (void) positiveOnly;
117  //m_sampleSink->feed(begin, end, positiveOnly);
118  //m_sampleFifo.write(begin, end);
120 }
ThreadedBasebandSampleSinkFifo * m_threadedBasebandSampleSinkFifo
void writeToFifo(SampleVector::const_iterator &begin, SampleVector::const_iterator &end)
+ Here is the call graph for this function:

◆ getSampleSinkObjectName()

QString ThreadedBasebandSampleSink::getSampleSinkObjectName ( ) const

Definition at line 127 of file threadedbasebandsamplesink.cpp.

References m_basebandSampleSink.

128 {
129  return m_basebandSampleSink->objectName();
130 }
BasebandSampleSink * m_basebandSampleSink

◆ getSink()

const BasebandSampleSink* ThreadedBasebandSampleSink::getSink ( ) const
inline

Definition at line 61 of file threadedbasebandsamplesink.h.

61 { return m_basebandSampleSink; }
BasebandSampleSink * m_basebandSampleSink

◆ getThread()

const QThread* ThreadedBasebandSampleSink::getThread ( ) const
inline

Definition at line 70 of file threadedbasebandsamplesink.h.

70 { return m_thread; }
QThread * m_thread
The thead object.

◆ handleSinkMessage()

bool ThreadedBasebandSampleSink::handleSinkMessage ( const Message cmd)

Send message to sink synchronously.

Definition at line 122 of file threadedbasebandsamplesink.cpp.

References BasebandSampleSink::handleMessage(), and m_basebandSampleSink.

Referenced by DSPDeviceSourceEngine::handleSynchronousMessages(), and DSPDeviceMIMOEngine::handleSynchronousMessages().

123 {
124  return m_basebandSampleSink->handleMessage(cmd);
125 }
BasebandSampleSink * m_basebandSampleSink
virtual bool handleMessage(const Message &cmd)=0
Processing of a message. Returns true if message has actually been processed.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void ThreadedBasebandSampleSink::start ( )

this thread start()

Definition at line 99 of file threadedbasebandsamplesink.cpp.

References m_basebandSampleSink, m_thread, and BasebandSampleSink::start().

Referenced by DSPDeviceSourceEngine::handleSynchronousMessages(), and DSPDeviceMIMOEngine::handleSynchronousMessages().

100 {
101  qDebug() << "ThreadedBasebandSampleSink::start";
102  m_thread->start();
104 }
QThread * m_thread
The thead object.
BasebandSampleSink * m_basebandSampleSink
virtual void start()=0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void ThreadedBasebandSampleSink::stop ( )

this thread exit() and wait()

Definition at line 106 of file threadedbasebandsamplesink.cpp.

References m_basebandSampleSink, m_thread, and BasebandSampleSink::stop().

Referenced by DSPDeviceSourceEngine::handleSynchronousMessages(), DSPDeviceMIMOEngine::handleSynchronousMessages(), and ~ThreadedBasebandSampleSink().

107 {
108  qDebug() << "ThreadedBasebandSampleSink::stop";
110  m_thread->exit();
111  m_thread->wait();
112 }
QThread * m_thread
The thead object.
BasebandSampleSink * m_basebandSampleSink
virtual void stop()=0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_basebandSampleSink

BasebandSampleSink* ThreadedBasebandSampleSink::m_basebandSampleSink
protected

◆ m_thread

QThread* ThreadedBasebandSampleSink::m_thread
protected

The thead object.

Definition at line 74 of file threadedbasebandsamplesink.h.

Referenced by start(), stop(), ThreadedBasebandSampleSink(), and ~ThreadedBasebandSampleSink().

◆ m_threadedBasebandSampleSinkFifo

ThreadedBasebandSampleSinkFifo* ThreadedBasebandSampleSink::m_threadedBasebandSampleSinkFifo
protected

The documentation for this class was generated from the following files: