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.
plutosdrinputthread.h
Go to the documentation of this file.
1 // Copyright (C) 2017 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTTHREAD_H_
19 #define PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTTHREAD_H_
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 
25 #include "dsp/samplesinkfifo.h"
26 #include "dsp/decimators.h"
28 
29 class DevicePlutoSDRBox;
30 
32 {
33  Q_OBJECT
34 
35 public:
36  PlutoSDRInputThread(uint32_t blocksize, DevicePlutoSDRBox* plutoBox, SampleSinkFifo* sampleFifo, QObject* parent = 0);
38 
39  virtual void startWork();
40  virtual void stopWork();
41  virtual void setDeviceSampleRate(int sampleRate) { (void) sampleRate; }
42  virtual bool isRunning() { return m_running; }
43  void setLog2Decimation(unsigned int log2_decim);
44  void setFcPos(int fcPos);
45 
46 private:
48  QWaitCondition m_startWaiter;
49  bool m_running;
50 
56  SampleVector::iterator m_convertIt;
58 
59  unsigned int m_log2Decim; // soft decimation
60  int m_fcPos;
61  float m_phasor;
62 
64 
65  void run();
66  void convert(const qint16* buf, qint32 len);
67 
68 };
69 
70 
71 #endif /* PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTTHREAD_H_ */
short int16_t
Definition: rtptypes_win.h:43
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
DevicePlutoSDRBox * m_plutoBox
virtual void setDeviceSampleRate(int sampleRate)
void setLog2Decimation(unsigned int log2_decim)
QWaitCondition m_startWaiter
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 12 > m_decimators
int16_t * m_buf
holds I+Q values of each sample from devce
void convert(const qint16 *buf, qint32 len)
unsigned int uint32_t
Definition: rtptypes_win.h:46
PlutoSDRInputThread(uint32_t blocksize, DevicePlutoSDRBox *plutoBox, SampleSinkFifo *sampleFifo, QObject *parent=0)
SampleVector m_convertBuffer
vector of (I,Q) samples used for decimation and scaling conversion
virtual bool isRunning()
SampleSinkFifo * m_sampleFifo
DSP sample FIFO (I,Q)
SampleVector::iterator m_convertIt
uint32_t m_blockSizeSamples
buffer sizes in number of (I,Q) samples
int16_t * m_bufConv
holds I+Q values of each sample converted to host format via iio_channel_convert