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 Slots | Public Member Functions | Public Attributes | List of all members
ThreadedBasebandSampleSinkFifo Class Reference

#include <threadedbasebandsamplesink.h>

Inherits QObject.

+ Collaboration diagram for ThreadedBasebandSampleSinkFifo:

Public Slots

void handleFifoData ()
 

Public Member Functions

 ThreadedBasebandSampleSinkFifo (BasebandSampleSink *sampleSink, std::size_t size=1<< 18)
 
 ~ThreadedBasebandSampleSinkFifo ()
 
void writeToFifo (SampleVector::const_iterator &begin, SampleVector::const_iterator &end)
 

Public Attributes

BasebandSampleSinkm_sampleSink
 
SampleSinkFifo m_sampleFifo
 

Detailed Description

Because Qt is a piece of shit this class cannot be a nested protected class of ThreadedSampleSink So let's make everything public

Definition at line 36 of file threadedbasebandsamplesink.h.

Constructor & Destructor Documentation

◆ ThreadedBasebandSampleSinkFifo()

ThreadedBasebandSampleSinkFifo::ThreadedBasebandSampleSinkFifo ( BasebandSampleSink sampleSink,
std::size_t  size = 1<<18 
)

Definition at line 8 of file threadedbasebandsamplesink.cpp.

References handleFifoData(), m_sampleFifo, and SampleSinkFifo::setSize().

8  :
9  m_sampleSink(sampleSink)
10 {
11  connect(&m_sampleFifo, SIGNAL(dataReady()), this, SLOT(handleFifoData()));
12  m_sampleFifo.setSize(size);
13 }
bool setSize(int size)
+ Here is the call graph for this function:

◆ ~ThreadedBasebandSampleSinkFifo()

ThreadedBasebandSampleSinkFifo::~ThreadedBasebandSampleSinkFifo ( )

Definition at line 15 of file threadedbasebandsamplesink.cpp.

References SampleSinkFifo::fill(), m_sampleFifo, and SampleSinkFifo::readCommit().

+ Here is the call graph for this function:

Member Function Documentation

◆ handleFifoData

void ThreadedBasebandSampleSinkFifo::handleFifoData ( )
slot

Definition at line 25 of file threadedbasebandsamplesink.cpp.

References BasebandSampleSink::feed(), SampleSinkFifo::fill(), BasebandSampleSink::getInputMessageQueue(), m_sampleFifo, m_sampleSink, SampleSinkFifo::readBegin(), SampleSinkFifo::readCommit(), and MessageQueue::size().

Referenced by ThreadedBasebandSampleSinkFifo().

26 {
27  bool positiveOnly = false;
28 
29  while ((m_sampleFifo.fill() > 0) && (m_sampleSink->getInputMessageQueue()->size() == 0))
30  {
31  SampleVector::iterator part1begin;
32  SampleVector::iterator part1end;
33  SampleVector::iterator part2begin;
34  SampleVector::iterator part2end;
35 
36  std::size_t count = m_sampleFifo.readBegin(m_sampleFifo.fill(), &part1begin, &part1end, &part2begin, &part2end);
37 
38  // first part of FIFO data
39 
40  if (count > 0)
41  {
42  // handle data
43  if(m_sampleSink != NULL)
44  {
45  m_sampleSink->feed(part1begin, part1end, positiveOnly);
46  }
47 
48  m_sampleFifo.readCommit(part1end - part1begin);
49  }
50 
51  // second part of FIFO data (used when block wraps around)
52 
53  if(part2begin != part2end)
54  {
55  // handle data
56  if(m_sampleSink != NULL)
57  {
58  m_sampleSink->feed(part2begin, part2end, positiveOnly);
59  }
60 
61  m_sampleFifo.readCommit(part2end - part2begin);
62  }
63  }
64 }
int size()
Returns queue size.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool positiveOnly)=0
uint readCommit(uint count)
uint readBegin(uint count, SampleVector::iterator *part1Begin, SampleVector::iterator *part1End, SampleVector::iterator *part2Begin, SampleVector::iterator *part2End)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeToFifo()

void ThreadedBasebandSampleSinkFifo::writeToFifo ( SampleVector::const_iterator &  begin,
SampleVector::const_iterator &  end 
)

Definition at line 20 of file threadedbasebandsamplesink.cpp.

References m_sampleFifo, and SampleSinkFifo::write().

Referenced by ThreadedBasebandSampleSink::feed().

21 {
22  m_sampleFifo.write(begin, end);
23 }
uint write(const quint8 *data, uint count)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_sampleFifo

SampleSinkFifo ThreadedBasebandSampleSinkFifo::m_sampleFifo

◆ m_sampleSink

BasebandSampleSink* ThreadedBasebandSampleSinkFifo::m_sampleSink

Definition at line 44 of file threadedbasebandsamplesink.h.

Referenced by handleFifoData().


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