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.
limesdrinputthread.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_LIMESDRINPUT_LIMESDRINPUTTHREAD_H_
19 #define PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTTHREAD_H_
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 
25 #include "lime/LimeSuite.h"
26 
27 #include "dsp/samplesinkfifo.h"
28 #include "dsp/decimators.h"
30 
31 #define LIMESDR_BLOCKSIZE (1<<15) //complex samples per buffer
32 
34 {
35  Q_OBJECT
36 
37 public:
38  LimeSDRInputThread(lms_stream_t* stream, SampleSinkFifo* sampleFifo, QObject* parent = 0);
40 
41  virtual void startWork();
42  virtual void stopWork();
43  virtual void setDeviceSampleRate(int sampleRate) { (void) sampleRate; }
44  virtual bool isRunning() { return m_running; }
45  void setLog2Decimation(unsigned int log2_decim);
46 
47 private:
49  QWaitCondition m_startWaiter;
50  bool m_running;
51 
52  lms_stream_t* m_stream;
53  qint16 m_buf[2*LIMESDR_BLOCKSIZE]; //must hold I+Q values of each sample hence 2xcomplex size
56 
57  unsigned int m_log2Decim; // soft decimation
58 
60 
61  void run();
62  void callback(const qint16* buf, qint32 len);
63 };
64 
65 
66 
67 #endif /* PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTTHREAD_H_ */
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
QWaitCondition m_startWaiter
qint16 m_buf[2 *LIMESDR_BLOCKSIZE]
virtual void setDeviceSampleRate(int sampleRate)
virtual void startWork()
SampleSinkFifo * m_sampleFifo
void setLog2Decimation(unsigned int log2_decim)
LimeSDRInputThread(lms_stream_t *stream, SampleSinkFifo *sampleFifo, QObject *parent=0)
virtual bool isRunning()
unsigned int m_log2Decim
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 12 > m_decimators
SampleVector m_convertBuffer
lms_stream_t * m_stream
void callback(const qint16 *buf, qint32 len)
#define LIMESDR_BLOCKSIZE