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.
rtlsdrthread.h
Go to the documentation of this file.
1 // Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
3 // written by Christian Daniel //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef INCLUDE_RTLSDRTHREAD_H
20 #define INCLUDE_RTLSDRTHREAD_H
21 
22 #include <QThread>
23 #include <QMutex>
24 #include <QWaitCondition>
25 #include <rtl-sdr.h>
26 
27 #include "dsp/samplesinkfifo.h"
28 #include "dsp/decimatorsu.h"
29 
30 class RTLSDRThread : public QThread {
31  Q_OBJECT
32 
33 public:
34  RTLSDRThread(rtlsdr_dev_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
35  ~RTLSDRThread();
36 
37  void startWork();
38  void stopWork();
39  void setSamplerate(int samplerate);
40  void setLog2Decimation(unsigned int log2_decim);
41  void setFcPos(int fcPos);
42 
43 private:
45  QWaitCondition m_startWaiter;
46  bool m_running;
47 
48  rtlsdr_dev_t* m_dev;
51 
53  unsigned int m_log2Decim;
54  int m_fcPos;
55 
57 
58  void run();
59  void callback(const quint8* buf, qint32 len);
60 
61  static void callbackHelper(unsigned char* buf, uint32_t len, void* ctx);
62 };
63 
64 #endif // INCLUDE_RTLSDRTHREAD_H
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
void setSamplerate(int samplerate)
void startWork()
static void callbackHelper(unsigned char *buf, uint32_t len, void *ctx)
void setFcPos(int fcPos)
unsigned int uint32_t
Definition: rtptypes_win.h:46
void setLog2Decimation(unsigned int log2_decim)
RTLSDRThread(rtlsdr_dev_t *dev, SampleSinkFifo *sampleFifo, QObject *parent=NULL)
QWaitCondition m_startWaiter
Definition: rtlsdrthread.h:45
rtlsdr_dev_t * m_dev
Definition: rtlsdrthread.h:48
unsigned int m_log2Decim
Definition: rtlsdrthread.h:53
DecimatorsU< qint32, quint8, SDR_RX_SAMP_SZ, 8, 127 > m_decimators
Definition: rtlsdrthread.h:56
QMutex m_startWaitMutex
Definition: rtlsdrthread.h:44
SampleSinkFifo * m_sampleFifo
Definition: rtlsdrthread.h:50
SampleVector m_convertBuffer
Definition: rtlsdrthread.h:49
void callback(const quint8 *buf, qint32 len)