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.
hackrfinputthread.h
Go to the documentation of this file.
1 // Copyright (C) 2015 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 INCLUDE_HACKRFINPUTTHREAD_H
19 #define INCLUDE_HACKRFINPUTTHREAD_H
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 #include <libhackrf/hackrf.h>
25 
26 #include "dsp/samplesinkfifo.h"
27 #include "dsp/decimators.h"
28 
29 #define HACKRF_BLOCKSIZE (1<<17)
30 
31 class HackRFInputThread : public QThread {
32  Q_OBJECT
33 
34 public:
35  HackRFInputThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
37 
38  void startWork();
39  void stopWork();
40  void setSamplerate(uint32_t samplerate);
41  void setLog2Decimation(unsigned int log2_decim);
42  void setFcPos(int fcPos);
43 
44 private:
46  QWaitCondition m_startWaiter;
47  bool m_running;
48 
49  hackrf_device* m_dev;
53 
55  unsigned int m_log2Decim;
56  int m_fcPos;
57 
59 
60  void run();
61  void callback(const qint8* buf, qint32 len);
62  static int rx_callback(hackrf_transfer* transfer);
63 };
64 
65 #endif // INCLUDE_HACKRFINPUTTHREAD_H
void setLog2Decimation(unsigned int log2_decim)
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
HackRFInputThread(hackrf_device *dev, SampleSinkFifo *sampleFifo, QObject *parent=NULL)
void callback(const qint8 *buf, qint32 len)
unsigned int uint32_t
Definition: rtptypes_win.h:46
unsigned int m_log2Decim
#define HACKRF_BLOCKSIZE
static int rx_callback(hackrf_transfer *transfer)
SampleSinkFifo * m_sampleFifo
QWaitCondition m_startWaiter
hackrf_device * m_dev
void setSamplerate(uint32_t samplerate)
qint16 m_buf[2 *HACKRF_BLOCKSIZE]
void setFcPos(int fcPos)
Decimators< qint32, qint8, SDR_RX_SAMP_SZ, 8 > m_decimators
SampleVector m_convertBuffer